//////////Module common//////////
//////////controller/Command.ts//////////
namespace game {
    export namespace common {

        /**
         * 整个游戏的进行顺序为:
         * INIT_MODULE(await) -> CHANGE_SCENE("login") -> 登录中 -> REGISTER_NET -> ENTER_GAME_LOADING(await) -> CHANGE_SCENE("hall"|"game")
         */
        export class Command {

            /**
             * 初始化模块
             * @type {string}
             */
            public static INIT_MODULE: string = "init_module";

            /**
             * 切换场景
             * @type {string}
             */
            public static CHANGE_SCENE: string = "change_scene";

            /**
             * 进入游戏加载，一般有进度条显示
             * @type {string}
             */
            public static ENTER_GAME_LOADING: string = "enter_game_loading";

            /**
             * 显示界面
             * @type {string}
             */
            public static OPEN_VIEW: string = "open_view";

            /**
             * 关闭界面
             * @type {string}
             */
            public static CLOSE_VIEW: string = "close_view";

            /**
             * 关闭场景
             * @type {string}
             */
            public static CLOSE_SCENE:string = "close_scene";


            /**
             * 注册网络监听
             * @type {string}
             */
            public static REGISTER_NET: string = "register_net";

            /**
             * AI 控制
             * @type {string}
             */
            public static AI_CONTROLLER: string = "ai_controller";
        }
    }
}

//////////controller/notification/OpenViewNB.ts//////////
namespace game {
    export namespace common {
        export class OpenViewNB {

            private _name: string;
            private _data: any;

            constructor(name: string, data: any = null) {
                this._name = name;
                this._data = data;
            }

            public get name(): string {
                return this._name;
            }

            public get data(): any {
                return this._data;
            }
        }
    }
}

//////////controller/notification/CloseViewNB.ts//////////
namespace game {
    export namespace common {
        export class CloseViewNB {

            private _name: string;

            constructor(name: string) {
                this._name = name;
            }

            public get name(): string {
                return this._name;
            }
        }
    }
}

//////////controller/notification/InitModuleNB.ts//////////
namespace game {
    export namespace common {
        export class InitModuleNB {

            private _rootView: cc.Node;
            private _progress: any;

            constructor(rootView: cc.Node,progress: any) {
                this._rootView = rootView;
                this._progress = progress;
            }

            public get rootView(): cc.Node {
                return this._rootView;
            }

            public get progress(): any {
                return this._progress;
            }
        }
    }
}

//////////controller/notification/ChangeSceneNB.ts//////////
namespace game {
    export namespace common {

        export class ChangeSceneNB {

            private _sceneName: string;
            private _data: any;

            constructor(sceneName: string, data: any = null) {
                this._sceneName = sceneName;
                this._data = data;
            }

            public get sceneName(): string {
                return this._sceneName;
            }

            public get data():any {
                return this._data;
            }
        }
    }
}

//////////controller/notification/CloseSceneNB.ts//////////
namespace game {
    export namespace common {

        export class CloseSceneNB {

            private _sceneName: string;
            private _data: any;

            constructor(sceneName: string, data: any = null) {
                this._sceneName = sceneName;
                this._data = data;
            }

            public get sceneName(): string {
                return this._sceneName;
            }

            public get data():any {
                return this._data;
            }
        }
    }
}



//////////Module tip//////////
//////////view/TipModule.ts//////////
namespace game {

    export namespace tip {

        export class TipModule extends mvc.Module {

            constructor() {
                super(TipModule.NAME);
            }

            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE, common.Command.REGISTER_NET, common.Command.OPEN_VIEW];
            }

            public handleNotification(note: mvc.Notification): void {
                switch (note.name) {
                    case common.Command.INIT_MODULE: //初始化模块
                        // var initData: common.InitModuleNB = note.body;
                        //
                        //初始化 view
                        this.facade.registerMediator(new MainMediator());
                        //
                        // //初始化 model
                        // //1. 加载网络监听对象
                        // this.receiveNetProxies.push(new NoticeCProxy());
                        // this.receiveNetProxies.push(new TestRecvCProxy());
                        // //2. 初始化 proxy
                        //
                        // //初始化 controller
                        // this.facade.registerCommand(Command.IN.AUTO_LOGIN, AutoLoginCommand);
                        // this.facade.registerCommand(Command.IN.LOGIN_GAME_SERVER, LoginCompleteCommand);
                        break;
                    case common.Command.OPEN_VIEW: //切换场景
                        if ((note.body as common.OpenViewNB).name == TipModule.NAME) {
                            this.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB(MainMediator.NAME,(note.body as common.OpenViewNB).data));
                        }
                        break;
                    case common.Command.REGISTER_NET: //注册网络模块
                        // for (let i = 0; i < this.receiveNetProxies.length; i++) {
                        //     this.receiveNetProxies[i].registerNet(game.net);
                        // }
                        break;
                }
            }

            public static NAME = "tip";
        }
    }
}

//////////view/MainMediator.ts//////////
namespace game {
    export namespace tip {

        export var mainMediator: MainMediator;

        export class MainMediator extends mvc.Mediator {

            constructor() {
                super(MainMediator.NAME, null);
                mainMediator = this;
            }

            private initUI(): void {
                this.viewComponent = new cc.Node();
                this.viewComponent.addComponent(MainComponent);
            }

            /**
             * 加载资源
             * @param {Function} resolve
             * @returns {Promise<void>}
             */
            protected async asyncLoad(resolve: Function) {
                super.asyncLoad(resolve);
                this.initUI();
                this.loadComplete();
            }

            public listNotificationInterests(): string[] {
                return [common.Command.OPEN_VIEW, common.Command.CLOSE_VIEW];
            }

            public async handleNotification(note: mvc.Notification) {
                switch (note.name) {
                    case common.Command.OPEN_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (!this.viewComponent) {
                            await this.load();
                        }
                        if (this.viewComponent && !this.viewComponent.parent) {
                            layer.TopLayer.show(this.viewComponent);
                            lib.Tween.to(this.viewComponent, 1, {opacity: 255}, null, {opacity: 0});
                        }
                        (this.viewComponent.getComponent(game.tip.MainComponent) as game.tip.MainComponent).showTip((note.body as common.OpenViewNB).data);
                        break;
                    case common.Command.CLOSE_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (this.viewComponent && this.viewComponent.parent) {
                            this.viewComponent.parent.removeChild(this.viewComponent);
                            this.viewComponent.destroy();
                            this.viewComponent = null;
                        }
                        break;
                }
            }

            public static NAME = "tip.MainMediator";
        }
    }
}

//////////view/MainComponent.ts//////////
namespace game {
    export namespace tip {
        export class MainComponent extends cc.Component {


            showTip(tip:string) {
                let root = new cc.Node();
                root.y = cc.director.getWinSize().height/4;
                this.node.addChild(root);
                let graphics:cc.Graphics = root.addComponent(cc.Graphics);
                graphics.fillColor = new cc.Color(50,50,50,100);

                let node = new cc.Node();
                root.addChild(node);
                let label:cc.Label = node.addComponent(cc.Label);
                label.fontSize = 30;
                label.string = tip;
                node.color = new cc.Color(0xff0000>>16,(0xff0000>>8)&0xFF,0xff0000&0xFF);
                lib.Tween.to(root,0.5,{y:cc.director.getWinSize().height/4 + cc.director.getWinSize().height/6}).call(
                    function(){
                        new lib.DelayCall(2500,1,function(){
                            root.destroy();
                        },null);
                    }
                );
                graphics.fillRect(-node.getContentSize().width/2 - 10,-node.getContentSize().height/2 - 5,node.getContentSize().width + 20,node.getContentSize().height + 10);
            }
        }
    }
}



//////////Module ui//////////
//////////sound/Sound.ts//////////
namespace game {
    export namespace ui {
        export class Sound extends cc.Component {
            private static bgmsmap = new Map<string, any>();
            private static bgmsIDmap = new Map<string, number>();
            private static heapbgm: string[] = []
            private static cleartime: number = 0

            public static playUrlBgm(sourcename: any, loop: boolean = false, vol: number = 1.0) {
                ///静音
                //if (game.data.game.soundstate == false)
                //    return
                //Sound.imp_playbgm(sourcename, loop, vol)
            }

            public static imp_playbgm(sourcename: any, loop: boolean = false, vol: number) {
                ///丢弃毫秒内触发相同的
                for (var i = 0; i < Sound.heapbgm.length; ++i) {
                    if (sourcename == Sound.heapbgm[i]) {
                        //console.log("丢弃" + sourcename)
                        return
                    }
                }
                //console.log("播放" + sourcename)
                ///添加到重复数组
                Sound.heapbgm.push(sourcename)

                ///如果存在过 加载好了
                if (Sound.bgmsmap.has(sourcename)) {
                    let audio = Sound.bgmsmap.get(sourcename)
                    cc.audioEngine.play(audio, loop, vol);
                } else {
                    let murl = "https://img.h5youxi.fun/sound/slime/" + sourcename + ".mp3"
                    cc.assetManager.load({ url: murl, type: 'mp3' }, function (e: any, audio: any) {
                        let bgmid = cc.audioEngine.play(audio, loop, vol);
                        if (bgmid > 0) {
                            Sound.bgmsmap.set(sourcename, audio)
                            Sound.bgmsIDmap.set(sourcename, bgmid)
                        }
                    });
                }

                ///删除数组
                Sound.clearheap()
            }

            private static clearheap() {
                var curtime = Date.now()
                if (curtime - Sound.cleartime > 20) {
                    Sound.heapbgm = []
                    Sound.cleartime = curtime
                    //console.log("超过清除")
                }
            }

            public static stopBgm(sourcename: any = null) {
                if (sourcename) {
                    let audio = Sound.bgmsIDmap.get(sourcename)
                    cc.audioEngine.stop(audio);
                } else {
                    cc.audioEngine.stopAll();
                }
            }

            public static playGamebgm(sourcename: any) {
                cc.audioEngine.stopAll();
                setTimeout(() => {
                    ui.Sound.playUrlBgm(sourcename, true, 0.7)
                }, 100);
            }


            // public static playUrlBgm(sourcename: any, loop: boolean = false, vol: number = 1.0) {
            //     if (game.data.game.soundstate == false)
            //         return
            //     let murl = gameStart.Resource.getResource(sourcename)
            //     cc.audioEngine.play(murl, loop, vol);
            // }
        }
    }
}

//////////tool/Func.ts//////////
namespace game {
    export namespace ui {
        export class Func extends cc.Component {
            /**
             * 资源路径
             */
            public static assetPath = {
                bulletPath: "myres/image/bullet/",
                monAniPath: "myres/ani/monsterAni/",
                playerAniPath: "myres/ani/playAni/",
                effectAniPath: "myres/ani/effect/",
                comImagePath: "myres/image/common/",
                bossPrefabPath: "prefabs/Boss/",
            };
            //提示飘动
            public static playTipMovie(tiptext: any, parent: cc.Node = null, localVec: cc.Vec2 = new cc.Vec2(0, 200)) {
                var tipNode = ui.PoolManager.getTipNode()
                var parentNode = parent ? parent : gameStart.MainComponent.gamestartpanel
                tipNode.scale = 1.5;
                tipNode.opacity = 255;
                var labelNode: cc.Node = tipNode.getChildByName("label");
                labelNode.getComponent(cc.Label).string = tiptext.toString();
                parentNode.addChild(tipNode);
                tipNode.setPosition(localVec);
                tipNode.runAction(
                    cc.sequence(
                        cc.scaleTo(0.1, 1.2, 1.2),
                        cc.scaleTo(0.1, 1, 1),
                        cc.delayTime(0.2),
                        cc.spawn(
                            cc.moveTo(1.5, cc.v2(tipNode.x, tipNode.y + 250)),
                            cc.fadeTo(1.5, 0)
                        ),
                        cc.callFunc(function () {
                            ui.PoolManager.pushNode(tipNode)
                            parentNode.removeChild(tipNode)
                        })
                    )
                );

                return tipNode;
            }
            /**
             * 求两点间距
             * @param x1
             * @param y1
             * @param x2
             * @param y2
             * @return
             */
            public static getDistance = function (x1: number, y1: number, x2: number, y2: number) {
                var t1: number = Math.pow(x1 - x2, 2);
                var t2: number = Math.pow(y1 - y2, 2);
                return Math.sqrt(t1 + t2);
            };
            /**
             * 截取字符串为指定长度
             * @param {string} $str
             * @param {number} length
             * @returns {string}
             */
            public static snatchString = function ($str: string, length: number) {
                for (let i = 0, c = 0; i < $str.length; i++) {
                    if ($str.charCodeAt(i) < 200) {
                        c++;
                    } else {
                        c += 2;
                    }
                    if (c >= (length + 1) * 2 && i < $str.length) {
                        $str = $str.slice(0, i) + "...";
                        break;
                    }
                }
                return $str;
            }

            public static createNetIcon(parent: cc.Node, url: string, callback: Function = null) {
                if (url == null || url == "") return;

                parent.removeAllChildren();
                var node: cc.Node = new cc.Node();
                parent.addChild(node);
                var sprite: cc.Sprite = node.addComponent(cc.Sprite);
                cc.assetManager.load(url, function (err: any, tex: any) {
                    if (err) {

                    } else {
                        var spriteFrame: cc.SpriteFrame = new cc.SpriteFrame(tex);
                        sprite.spriteFrame = spriteFrame;
                        var scale: number = parent.width / node.width;
                        node.scale = scale;
                        // spriteFrame.retain();
                        if (callback) {
                            callback();
                        }
                    }
                });
            }
            // ui.Func.TipsMessageShow(1, null, '打打', function () { cc.log("ok回调") });
            public static TipsMessageShow(btnNum: number, title: string, des: string, Okcallback: Function = null, CancelCallFun: Function = null, okStr: string = null, cancelStr: string = null, goodsIcon: string = null): gameData.TipsMessage {

                let tips = new gameData.TipsMessage();
                btnNum = btnNum > 1 ? 2 : 1;
                title = (title == null || title == '提示') ? "common/commonIcon/lb_hint" : title;
                des = des == null ? '' : des;
                tips.btnNum = btnNum; //按钮个数
                tips.titleStr = title; //提示文字 （带‘/’为路径名，否则为普通文字提示）
                tips.tipsStr = des;//正文显示/物品说明
                tips.OkCallFun = Okcallback ? Okcallback : function () { }; //右边按钮（确定）回调
                tips.CancelCallFun = CancelCallFun ? CancelCallFun : function () { };//左边按钮（取消）回调
                tips.OkStr = okStr == null ? "common/txt/okTxt" : okStr; //右边按钮文字（默认确定）
                tips.CancelStr = cancelStr == null ? "common/txt/cancelTxt" : cancelStr;//左边按钮文字（取消）
                tips.goodsIcon = goodsIcon == null ? "" : goodsIcon;//物品icon
                game.data.tipsArr.push(tips);
                return tips;
            }
            // ui.Func.GainMessageShow(1000, icon);
            public static GainMessageShow(gainNum: number, pathIcon: string): gameData.GainMessage {

                let gain = new gameData.GainMessage();
                gain.gainNum = gainNum;
                gain.pathicon = pathIcon;
                game.data.gainArr.push(gain);
                return gain;
            }
            public static AutoGetNodesMap(root: cc.Node, _key: string = 'N'): Map<string, cc.Node> {
                let map = new Map<string, cc.Node>();
                for (let i = 0; i < root.childrenCount; i++) {
                    let childNode: cc.Node = root.children[i];
                    let childName: string = childNode.name;
                    let tmp: string[] = childName.split('_');
                    if (tmp.length > 1) {
                        let prefix: string = tmp[0];
                        if (prefix == _key) {
                            if (map.has(childName)) throw new Error('CC.Node-----添加重复名' + childName);

                            map.set(childName, childNode);
                        }
                    }
                    let tmpMap = Func.AutoGetNodesMap(childNode, _key);

                    if (tmpMap.size > 0) {
                        tmpMap.forEach((value, key) => {
                            if (map.has(key)) throw new Error('CC.Node-----添加重复名' + key);

                            map.set(key, value);
                        });
                    }
                }

                return map;
            }
            public static GetComponentFormMap<T extends cc.Component>(_map: Map<string, cc.Node>, _key: string): cc.Node;
            public static GetComponentFormMap<T extends cc.Component>(_map: Map<string, cc.Node>, _key: string, type: { prototype: T }): T;
            public static GetComponentFormMap<T extends cc.Component>(_map: Map<string, cc.Node>, _key: string, type: { prototype: T } = null): any {

                if (_key == null || _key == '' || _map == null || _map.size == 0) throw new Error('Map查找组件不合法' + _key);

                let tpNode = _map.get(_key);

                if (tpNode == null) throw new Error('Map中没有cc.Node--' + _key);

                if (type == null) {
                    return tpNode;
                }
                let tpCom = tpNode.getComponent(type);
                if (tpCom == null) throw new Error('cc.Node-' + _key + " 中不存在需要的组件");
                return tpCom;
            }
            //动态加载设置图片 icon
            public static UrlToIconMap = new Map<string, cc.SpriteFrame>();//图片缓存字典
            public static SetSpriteIcon(ulr: string, _sprite: cc.Sprite, _active: boolean = true) {
                if (ui.Func.UrlToIconMap.has(ulr)) {
                    if (_sprite) {
                        _sprite.spriteFrame = ui.Func.UrlToIconMap.get(ulr);
                        if (_active) _sprite.node.active = _active;
                    }
                } else {
                    cc.assetManager.loadRes(ulr, cc.SpriteFrame, function (err, spriteFrame) {
                        if (err) throw new Error('图片路径ulr--' + ulr + '错误');
                        ui.Func.UrlToIconMap.set(ulr, spriteFrame);
                        // cc.log(ulr);
                        if (_sprite) {
                            _sprite.spriteFrame = spriteFrame;
                            if (_active) _sprite.node.active = _active;
                        }
                    });
                }

            }
            //动态加载龙骨 
            public static UrlToSpSkeletonMap = new Map<string, sp.SkeletonData>();//龙骨缓存字典
            public static SetSpSkeleton(ulr: string, _sp: sp.Skeleton, callBack: Function) {
                if (ui.Func.UrlToSpSkeletonMap.has(ulr)) {
                    if (_sp) _sp.skeletonData = ui.Func.UrlToSpSkeletonMap.get(ulr);
                    if (callBack) callBack();
                } else {
                    cc.assetManager.loadRes(ulr, sp.SkeletonData, function (err, skeletonData) {
                        if (err) throw new Error('龙骨路径ulr--' + ulr + '错误');
                        ui.Func.UrlToSpSkeletonMap.set(ulr, skeletonData);
                        if (_sp) _sp.skeletonData = skeletonData;
                        if (callBack) callBack();
                    });
                }
            }
            //动态加载prefab 
            public static UrlToPrefabMap = new Map<string, cc.Node>();//Prefab缓存字典
            public static UrlToPrefab(ulr: string, fun: Function) {

                if (ui.Func.UrlToPrefabMap.has(ulr)) {
                    fun(ui.Func.UrlToPrefabMap.get(ulr));
                } else {
                    cc.assetManager.loadRes(ulr, function (err, prefab) {
                        if (err) throw new Error('prefab路径ulr--' + ulr + '错误');
                        ui.Func.UrlToPrefabMap.set(ulr, prefab);
                        fun(prefab);
                    });
                }

            }
            //动态添加节点
            public static CreateRoot(parent: cc.Node, strList: string[]): Map<string, cc.Node> {
                let tpRoot: cc.Node;
                let tpMap = new Map<string, cc.Node>();
                strList.forEach(element => {
                    tpRoot = new cc.Node();
                    tpMap.set(element, tpRoot);
                    parent.addChild(tpRoot);
                });
                return tpMap;
            }
            public static swapShowTimes = function (value: number) {
                var times = [];
                var hour: number = parseInt(Math.floor((value / 3600)).toString());
                if (hour <= 0) {
                    times[0] = 0;
                    times[1] = 0;
                } else if (hour < 10 && hour > 0) {
                    times[0] = 0;
                    times[1] = hour;
                } else {
                    times[0] = parseInt((hour / 10).toString());
                    times[1] = parseInt((hour % 10).toString());
                }
                var min: number = parseInt(Math.floor((value % 3600 / 60)).toString());
                if (min <= 0) {
                    times[2] = 0;
                    times[3] = 0;
                } else if (min < 10 && min > 0) {
                    times[2] = 0;
                    times[3] = min;
                } else {
                    times[2] = parseInt((min / 10).toString());
                    times[3] = parseInt((min % 10).toString());
                }
                var sec = value % 60;
                if (sec <= 0) {
                    times[4] = 0;
                    times[5] = 0;
                } else if (sec < 10) {
                    times[4] = 0;
                    times[5] = sec;
                } else {
                    times[4] = parseInt((sec / 10).toString());
                    times[5] = parseInt((sec % 10).toString());
                }
                return times;
            };
            public static getStandardTime(value: number) {
                var times = Func.swapShowTimes(value);
                return times[0].toString() + times[1].toString() + ":" + times[2].toString() + times[3].toString() + ":" + times[4].toString() + times[5].toString();
            }

            public static getStandardTime2(value: number) {
                var times = Func.swapShowTimes(value);
                return times[2].toString() + times[3].toString() + ":" + times[4].toString() + times[5].toString();
            }


            /**
             * 转数值成字母表达式
             * @param {value} value
             * @returns {string}
             */
            public static number2formatString = function (value: number) {
                //if (value < 0) value = 0

                if (value <= Math.pow(10, 3))
                    return value.toString()

                var len = 0, t_value = value, str = "";
                while (t_value > 1) {
                    t_value /= 10;
                    len++;
                }
                //console.log("数字原型:" + value + "  数字长度是:" + len)

                let a_arr: Array<string> = ["", "K", "M", "B", "T", "aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh", "ii", "jj", "kk", "ll", "mm", "nn", "oo", "pp", "qq", "rr", "ss", "tt", "uu", "vv", "ww", "xx", "yy", "zz"];
                var jinweishu = Math.floor((len - 1) / 3)
                var tailstr = a_arr[jinweishu]

                //console.log("字母进位数:" + jinweishu + "  字母表达" + tailstr)

                var fontstr = value / Math.pow(10, jinweishu * 3);
                str = fontstr.toFixed(1) + tailstr
                return str;
            }

            /**
             * 物体向目标点移动
             * @param _node 物体
             * @param _targetPos 目标点
             * @param _dis 移动距离
             * @param _rad 半径
             */
            public static nodeTranslate(_node: cc.Node, _targetPos: cc.Vec2, _dis: number, _rad: number = 1): boolean {
                let _isDo = false;
                //移动
                let tarV: cc.Vec2 = new cc.Vec2();
                _targetPos.clone().sub(_node.position, tarV);

                if (tarV.magSqr() < _rad * _rad) {
                    _node.position = _targetPos.clone();
                    _isDo = true;//到达终点
                } else {
                    tarV.normalizeSelf();
                    _node.position = _node.position.addSelf(tarV.mulSelf(_dis));
                }

                return _isDo;
            }

            /**
             * 点1 是否在 点2的范围内
             * @param _pos1 点1
             * @param _pos2 点2
             * @param _rad 半径
             */
            public static isRange(_pos1: cc.Vec2, _pos2: cc.Vec2, _rad: number = 1): boolean {
                let _isDo = false;
                let tarV: cc.Vec2 = new cc.Vec2();
                _pos2.clone().sub(_pos1, tarV);

                _isDo = tarV.magSqr() < _rad * _rad

                // console.log("israng", tarV.magSqr() - _rad * _rad);

                return _isDo;
            }

            /**
             * 将数字字符串转换成number数组("500,500,120")=> [500,500,120]
             * @param _str 原字符串
             * @param _char 分割符
             */
            public static StringSplit(_str: string, _char: string = ','): number[] {
                let resArr: number[] = [];
                let _strArr = _str.split(_char);
                for (let i = 0; i < _strArr.length; i++) {
                    resArr.push(Number.parseFloat(_strArr[i]))
                }
                return resArr;
            }

            /**
             * 设置面板缩放动画 
             * @param _root 根节点
             * @param _content 缩放内容节点
             * @param _active //显隐          
             */
            public static setNodeScaleAni(_root: cc.Node, _content: cc.Node, _active: boolean) {
                if (_active) {
                    _root.active = _active;
                    _content.scale = 0.1;
                    _content.runAction(cc.scaleTo(0.5, 1, 1).easing(cc.easeBackOut()));
                } else {
                    _content.scale = 1;
                    _content.runAction(cc.scaleTo(0.5, 0.05, 0.05).easing(cc.easeBackIn()));
                    game.layer.MainUILayer.instance.scheduleComponent.scheduleOnce(function () {
                        _root.active = _active;
                    }, 0.5);
                }
            }

            /**
             * 整数随机数
             * @param _min 最小值
             * @param _max 最大值
             */
            public static MathRandom(_min: number, _max: number): number {
                let _ran = Math.round(Math.random() * (_max - _min) + _min);
                return _ran;
            }

            public static log(message?: any, ...optionalParams: any[]) {
                return;
                console.log(message, optionalParams);
            }

            /**
             * 延迟函数调用
             * @param _time 时间
             * @param callBack 回调
             * @param loop 是否循环
             */
            public static scheduleComponent(_time: number, callBack: Function, loop: boolean = false) {
                let com = layer.MainUILayer.instance.scheduleComponent;
                if (!com) throw new Error('没有scheduleComponent');
                if (loop) {
                    com.schedule(callBack, _time);
                } else {
                    com.scheduleOnce(callBack, _time);
                }
            }

        }
    }
}




//////////tool/ThreeSDKFunc.ts//////////
namespace game {
    export namespace ui {
        export class ThreeSDKFunc {

            private static b_watchAd = false

            private static b_getAdFail = false

            /**
             * 设置Banner 广告
             * @param _bool true-显示 false-关闭
             */
            public static SetBanner(_bool: boolean) {
                if (G_netdata.b_wxplatform) {
                    if (_bool) {
                        wx2g_showBannerBottom("adunit-0361a154bb9a94ec");
                    } else {
                        wx2g_hideBanner();
                    }
                }
            }

            /**
             * 设置震动
             * @param _shake 0-小 1-大
             */
            public static SetShake(_shake: number = 0) {
                if (!playGame.gameData.shakestate) return;
                if (G_netdata.b_wxplatform) {
                    switch (_shake) {
                        case 0:
                            wx2g_shakeSmall();
                            break;
                        case 1:
                            wx2g_shakeBig();
                            break;
                        default:
                            wx2g_shakeSmall();
                            break;
                    }

                }
            }

            /**
             * 获得当前玩家数据
             */
            public static GetUserInfo(): any {
                if (window.wx2g_userinfo) {
                    return wx2g_userinfo.userInfo;
                }
                return null;
            }
            /**
             * 
             * @param _type 0-游戏退出 1-游戏重启 2-游戏暂停 3-游戏开始
             */
            public static setGameACT(_type: number = 0) {
                switch (_type) {
                    case 0:
                        cc.game.end();
                        break;
                    case 1:
                        cc.game.restart();
                        break;
                    case 2:
                        break;
                    case 3:
                        break;
                }
            }


            public static randomwatch2share() {
                if (ThreeSDKFunc.b_getAdFail) {
                    ThreeSDKFunc.b_watchAd = false
                } else {
                    ThreeSDKFunc.b_getAdFail = false
                    if (game.data.game.todaywatchvideonum < 10) {
                        ThreeSDKFunc.b_watchAd = true
                    } else {
                        ThreeSDKFunc.b_watchAd = false
                    }
                }
            }

            ////看视频还是 分享
            public static iswatch_or_share(): boolean {
                return ThreeSDKFunc.b_watchAd;

            }

            ////看视频还是 分享
            public static click_watch_share(bWatch: boolean, WcallBackSuc: Function = null, ShareSuc: Function = null, ShareFail: Function = null) {
                if (bWatch) {
                    if (G_netdata.b_wxplatform) {
                        console.log("点击了看视频按钮----")
                        wx2g_hideBanner();
                        wx2g_showRewardVideo(
                            () => {
                                if (WcallBackSuc)
                                    WcallBackSuc()
                                console.log("看视频----成功 ")
                                game.data.game.todaywatchvideonum++
                                ThreeSDKFunc.randomwatch2share()
                            },
                            (exit: boolean) => {
                                if (ShareFail) ShareFail()
                                if (!exit) {
                                    ui.Func.playTipMovie("未知错误,获得不到视频")
                                    ThreeSDKFunc.b_getAdFail = true
                                    ThreeSDKFunc.randomwatch2share()
                                }
                                console.log("看视频---失败 ")
                            }
                        );
                    } else {
                        if (WcallBackSuc)
                            WcallBackSuc()
                        console.log("本地看视频----成功 ")
                        game.data.game.todaywatchvideonum++
                        ThreeSDKFunc.randomwatch2share()
                    }
                }
                else {
                    console.log("点击了分享按钮----")
                    gameShare.Share.share(ShareSuc, ShareFail)
                }
            }

            /**
             * 看视频或分享
             * @param callBack 成功回调
             * @param FailcallBack 失败回调
             */
            public static WatchOrShare(callBack: Function, FailcallBack: Function = null) {
                if (ThreeSDKFunc.iswatch_or_share()) {
                    ThreeSDKFunc.click_watch_share(true, callBack, null, FailcallBack);
                } else {
                    ThreeSDKFunc.click_watch_share(false, null, callBack, FailcallBack);
                }
            }
        }
    }
}


//////////tool/EnumDatas.ts//////////
namespace game {

    export enum GroupEnum {
        monster,
        player,
        playerBullet,
        helpBullet,
        goods
    }
    export enum EffectEnum {
        hit = 0,
        die = 1,
        toxic = 2,
        frozen = 3,
        explodeHit = 4,
        gain = 5,
        addHp,
        blackHole,
        skrink,
        restrict
    }
    /**
     * 玩家状态
     */
    export enum HeroStateEnum {
        none = 0,
        enterPanel,
        goDown,
        goUp,
        waitGo,
        enterGame,
        playGame = 11,
        playInv,
        playDying,
        playDeath,
        playResing,
        overGame,
        exitGame
    }
    /**
     * 方向枚举
     */
    export enum DirEnum {
        right,
        rightUp,
        up,
        leftUp,
        left,
        leftDown,
        down,
        rightDown,
        vertical//垂直
    }

    /**
     * 速度 属性系数
     */
    export enum mstSpdRateEnum {
        none,//置空
        global,//全局
        base,//自身基础
        fix,//固定
        scale,//体积影响
        booA,//爆炸时加速
        addSkill,//加速技能
        weapon,//副武器
        random,//随机速度
        length
    }

    /**
    *大小 属性系数
    */
    export enum mstScaleRateEnum {
        none,//置空
        global,//全局
        base,//自身基础
        fix,//固定    
        init,//初始值
        addSkill,//增大技能
        weapon,//副武器
        length
    }

    export enum heroMoveEnum {
        none,//置空    
        addBuf,//buf 加速
        subBuf,//buf 减速
        addMst,//怪物 加速
        subMst, //怪物 减速
        length
    }
    /**
     * 控制类 枚举
     */
    export enum CtrEnum {
        buff,
        bullet,
        effect,
        Goods,
        level,
        length
    }
}




//////////tool/MainDataManager.ts//////////
namespace game {
    export namespace ui {
        export class MainDataManager extends cc.Component {
            //获取当前皮肤

        }
    }
}




//////////tool/loadResource.ts//////////


//////////tool/MathData.ts//////////
namespace game {
    export namespace ui {
        export class MathData {
            /**
             * 数字单位
             */
            public static a_arr: Array<string> = ["", "K", "M", "B", "T", "aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh", "ii", "jj", "kk", "ll", "mm", "nn", "oo", "pp", "qq", "rr", "ss", "tt", "uu", "vv", "ww", "xx", "yy", "zz"];
            /**
             * 数字符 转 数组("500,500,120")=> [500,500,120]
             * @param _str 原字符串
             * @param _char 分割符
             */
            public static StringSplit(_str: string, _char: string = ','): number[] {
                let resArr: number[] = [];
                if (_str && _str !== '') {
                    let _strArr = _str.split(_char);
                    for (let i = 0; i < _strArr.length; i++) {
                        resArr.push(Number.parseFloat(_strArr[i]))
                    }
                }
                return resArr;
            }
            /**
             * 数组 转 字符[500,500,120] =>  "500-500-120"
             * @param _numArr 数组
             * @param _char 分割符
             */
            public static numArrToString(_numArr: number[], _char: string = '-'): string {
                let resString = ''
                for (let i = 0; i < _numArr.length; i++) {
                    resString += _numArr[i];
                    if (i < _numArr.length - 1) resString += _char;
                }
                return resString;
            }

            /**
             * 随机整数 包含 最大和最小值
             * @param _min 最小值
             * @param _max 最大值
             */
            public static MathRandom(_min: number, _max: number): number {
                let _ran = Math.round(Math.random() * (_max - _min) + _min);
                return _ran;
            }
            /**
             * 随机数 包含 最大和最小值
             * @param _min 最小值
             * @param _max 最大值
             */
            public static MathRandomFloat(_min: number, _max: number): number {
                return Math.random() * (_max - _min) + _min;
            }
            /**
             * 随机概率
             * @param Rrob 概率
             * @param _min 
             * @param _max 
             */
            public static RrobRandom(Rrob: number, _min: number = 0, _max: number = 100): boolean {
                return MathData.MathRandom(_min, _max) <= Rrob;
            }
            /**
             * 随机曲线到第几位 最小1 最大_max
             * @param _max 分多少次
             * @param _rale 分母
             */
            public static MathRandomCurve(_max: number, _rale: number = 2): number {
                _max = Math.floor(_max);
                let tpArr: number[] = [];
                let sumVal = 0;
                for (let i = 0; i < _max - 1; i++) {
                    sumVal += (_max - sumVal) / _rale;
                    tpArr.push(sumVal)
                }
                tpArr.push(_max);
                let vale = MathData.MathRandomFloat(0, _max);
                for (let i = 0; i < tpArr.length; i++) {
                    if (vale < tpArr[i]) return i + 1;
                }
            }
            /**
             * 曲线等分
             * @param _target 最大值
             * @param _rale 等分数
             * @param _lv 几分
             */
            public static MathCurve(_target: number, _rale: number, _lv: number = 1): number {
                let reNum = 0;
                let sumVal = _target;
                let tpNum = 0;
                for (let i = 0; i < _lv; i++) {
                    tpNum = sumVal / _rale
                    reNum += tpNum;
                    sumVal = _target - reNum;
                }
                return reNum;
            }
            /**
             * 数组 乱序
             * @param arr 
             */
            public static ArrShuffle<T>(arr: T[]) {
                let len = arr.length - 1;
                let index: number;
                let temp: T;
                for (let i = 0; i < arr.length; i++) {
                    index = MathData.MathRandom(0, len);
                    temp = arr[index];
                    arr[index] = arr[len - i];
                    arr[len - i] = temp;
                }
            }
            /**
             * 获得固定长度数组 默认值
             * @param maxNum 
             * @param vale 
             */
            public static GetArray(maxNum: number, vale: number): number[] {
                let arr: number[] = [];
                for (let i = 0; i < maxNum; i++) {
                    arr.push(vale);
                }
                return arr;
            }
            /**
             * 数组去重
             * @param arr 
             */
            public static ArrSuSame<T>(arr: T[]): T[] {
                let newArr = new Set(arr);
                return Array.from(newArr);
            }
            /**
             * 返回 目标限制值 （最大或最小或原值）
             * @param _targNum 目标
             * @param minNum 最小
             * @param maxNum 最大
             */
            public static NumberMiddle(_targNum: number, minNum: number, maxNum: number): number {
                if (_targNum < minNum) return minNum;
                else if (_targNum > maxNum) return maxNum;
                else return _targNum;
            }
            /**
             * 是否是同一周 两个时间戳 毫秒
             * @param _num1 
             * @param _num2 
             */
            public static isWeek(_num1: number, _num2: number): boolean {

                let tpDate1 = new Date(_num1);
                let tpDate2 = new Date(_num2);
                console.log("isWeek 111", _num2);
                if (tpDate1.getFullYear() == tpDate2.getFullYear()) {
                    let mon1 = tpDate1.getDate() - tpDate1.getDay();
                    let mon2 = tpDate2.getDate() - tpDate2.getDay();
                    let yun1 = tpDate1.getMonth();
                    let yun2 = tpDate2.getMonth();
                    if (mon1 < 0) yun1--;
                    if (mon2 < 0) yun2--;

                    if (mon1 == mon2 && yun1 == yun2) return true;
                }
                // //时间函数
                // var testDate = new Date();

                // // testDate.getYear();        //获取当前年份(2位)
                // testDate.getFullYear();    //获取完整的年份(4位,1970-????)
                // testDate.getMonth();       //获取当前月份(0-11,0代表1月)
                // testDate.getDate();        //获取当前日(1-31)   2018 11 6 4
                // testDate.getDay();         //获取当前星期X(0-6,0代表星期天)
                // console.log('showSpMedIcon', testDate.getFullYear(), testDate.getMonth(), testDate.getDate(), testDate.getDay());
                return false;
            }

            /**
             * 是否是同一周 两个时间戳 毫秒 
             * 思路: 因为1970年1月1 是周4   所以（天数+4）/7 取整 就是周数  如果相同就是同一周反之就不是
                    经过测试,是以星期一作为每周的第一天的
             * @param old 
             * @param now 
             */
            public static isSameWeek(old: number, now: number): boolean {
                console.log("isSameWeek", old, now);
                let oneDayTime = 1000 * 60 * 60 * 24;
                let old_count = Math.ceil(old / oneDayTime);
                let now_other = Math.ceil(now / oneDayTime);
                let res = Math.ceil((old_count + 4) / 7) == Math.ceil((now_other + 4) / 7);
                console.log("isSameWeek", res);
                return res;

            }
            /**
             * 两点之间的距离
             * @param _pos1 
             * @param _pos2 
             * @param _bool  false-距离 true-距离平方
             */
            public static twoPosDis(_pos1: cc.Vec2, _pos2: cc.Vec2, _bool: boolean = true): number {
                let tarV: cc.Vec2 = new cc.Vec2();
                _pos2.clone().sub(_pos1, tarV);
                if (_bool)
                    return tarV.magSqr();
                else
                    return tarV.mag();
            }
            /**
              * 点1 在 点2 范围内 圆形
              * @param _pos1 点1
              * @param _pos2 点2
              * @param _rad 半径
              */
            public static isRange(_pos1: cc.Vec2, _pos2: cc.Vec2, _rad: number = 1): boolean {
                let _isDo = false;
                _isDo = MathData.twoPosDis(_pos1, _pos2) < _rad * _rad
                return _isDo;
            }
            /**
            * 转数值成字母表达式
            * @param {value} value
            * @returns {string}
            */
            public static number2formatString(value: number) {
                if (value < 0) value = 0

                if (value < Math.pow(10, 3))
                    return value.toString()

                let len = 0, t_value = value, str = "";
                while (t_value >= 1) {
                    t_value /= 10;
                    len++;
                }


                //确定单位
                let jinweishu = Math.floor((len - 1) / 3);
                let tailstr = MathData.a_arr[jinweishu];
                let shiweishu = (len - 1) % 3;


                let fontstr = value / Math.pow(10, jinweishu * 3);
                str = fontstr.toFixed(2 - shiweishu) + tailstr
                return str;
            }

            static RandomAveArr: number[] = [];
            /**
             * 随机分配 数值 总值不变
             * @param sum 
             * @param SplitNum 
             * @param baseNum 
             * @param topNum 
             */
            public static RandomAveNum(sum: number, SplitNum: number, baseNum: number, topNum: number) {
                if (MathData.RandomAveArr.length < SplitNum) {
                    let len = SplitNum - MathData.RandomAveArr.length;
                    for (let i = 0; i < len; i++) {
                        MathData.RandomAveArr.push(0);
                    }
                }
                let aveHp = sum / SplitNum;
                let tpNum = 0;
                sum = sum - baseNum * SplitNum;
                for (let i = 0; i < SplitNum; i++) {
                    if (sum > 0) {
                        tpNum = MathData.MathRandomFloat(0, topNum);
                        if (sum >= tpNum) {
                            sum -= tpNum;
                        } else {
                            tpNum = sum;
                            sum = 0;
                        }
                    } else {
                        tpNum = 0;
                    }
                    MathData.RandomAveArr[i] = baseNum + tpNum;
                }

                if (sum > 0) {
                    aveHp = sum / SplitNum;
                    let index = 0;
                    while (true) {
                        if (sum > 0) {
                            tpNum = MathData.MathRandomFloat(0, aveHp);
                            index = MathData.MathRandom(0, SplitNum - 1);
                            if ((MathData.RandomAveArr[index] + tpNum) < topNum) {
                                if (sum >= tpNum) {
                                    sum -= tpNum;
                                } else {
                                    tpNum = sum;
                                    sum = 0;
                                }
                                MathData.RandomAveArr[index] += tpNum;
                            }
                        } else {
                            break;
                        }
                    }
                }

                // ui.MathData.ArrShuffle<number>(reArr);

                return MathData.RandomAveArr;
            }
        }
    }
}


//////////tool/VectorTool.ts//////////
namespace game {
    export namespace ui {
        export class VectorTool {

            //----------------逆时针 向量坐标系 三角函
            /**
            * 获得一个 0-360 范围的角度
            * @param _angle 目标角度
            */
            public static getAbsAngle(_angle: number) {
                _angle = _angle % 360;
                if (_angle < 0) _angle = 360 + _angle;
                return _angle;
            }
            /**
             * 角度 弧度 互换 角度-(0-360)  弧度-(0-6.28)2Π
             * @param _num false-角度  true-弧度
             * @param _bool false-角度to弧度 true-弧度to角度 
             */
            private static angleOrRadian(_num: number, _bool: boolean = false): number {
                let _oneRadian = Math.PI / 180;

                if (_bool) {
                    return _num / _oneRadian;
                } else {
                    // console.log('angleOrRadian', _num, _num * _oneRadian);
                    return _num * _oneRadian;
                }

            }

            /**
             * 角度 对应的三角函数值
             * @param _angle 角度
             * @param _type 0-sin 1-cos 2-tan
             * @param _bool false-角度to值 true-值to角度 
             */
            private static angleOrValue(_num: number, _type: number = 0, _bool: boolean = false): number {
                let res = 0;
                let _radian = 0;
                if (_bool) {
                    switch (_type) {
                        case 0:
                            _radian = Math.asin(_num);
                            break;
                        case 1:
                            _radian = Math.acos(_num);
                            break;
                        case 2:
                            _radian = Math.atan(_num);
                            break;
                        default:
                            break;
                    }
                    res = VectorTool.angleOrRadian(_radian, _bool);
                } else {
                    _radian = VectorTool.angleOrRadian(_num, _bool);
                    switch (_type) {
                        case 0:
                            res = Math.sin(_radian);
                            break;
                        case 1:
                            res = Math.cos(_radian);
                            break;
                        case 2:
                            res = Math.tan(_radian);
                            break;
                        default:
                            break;
                    }
                }

                // console.log('angleOrValue', _num, _radian, res);
                return res;
            }

            /**
             * 输入角度 和长度 获得 y轴分量 
             * @param speedOrigin 长度
             * @param moveAngle 角度
             */
            private static getSpeedY(speedOrigin: number, moveAngle: number): number {
                moveAngle = VectorTool.getAbsAngle(moveAngle);

                speedOrigin = Math.abs(speedOrigin);

                if (moveAngle === 90 || moveAngle === 270) return moveAngle === 90 ? speedOrigin : -speedOrigin;
                else if (moveAngle === 0 || moveAngle === 180) return 0;

                // return Math.sin(moveAngle) * speedOrigin;
                return VectorTool.angleOrValue(moveAngle, 0, false) * speedOrigin;
            }

            /**
             * 输入角度 和长度 获得 x轴分量 
             * @param speedOrigin 长度
             * @param moveAngle 角度
             */
            private static getSpeedX(speedOrigin: number, moveAngle: number): number {
                moveAngle = VectorTool.getAbsAngle(moveAngle);
                speedOrigin = Math.abs(speedOrigin);

                if (moveAngle === 0 || moveAngle === 180) return moveAngle === 0 ? speedOrigin : -speedOrigin;
                else if (moveAngle === 90 || moveAngle === 270) return 0;

                return VectorTool.angleOrValue(moveAngle, 1, false) * speedOrigin;
            }

            /**
             * 向量 x轴夹角
             * @param lenX 
             * @param lenY 
             */
            public static getAngleByVect2(lenX: number, lenY: number): number {
                if (lenY === 0) {
                    return lenX >= 0 ? 0 : 180;
                }

                if (lenX === 0) {
                    return lenY >= 0 ? 90 : 270;
                }

                let tan_yx = Math.abs(lenY) / Math.abs(lenX);
                let angle = 0;
                let absAngle = VectorTool.angleOrValue(tan_yx, 2, true);
                if (lenY > 0 && lenX > 0) {
                    angle = absAngle;
                } else if (lenY > 0 && lenX < 0) {
                    angle = 180 - absAngle;
                } else if (lenY < 0 && lenX < 0) {
                    angle = 180 + absAngle;
                } else if (lenY < 0 && lenX > 0) {
                    angle = 360 - absAngle;
                }

                return angle;
            }

            private static angleV2 = cc.v2();
            /**
             * x轴角度 向量
             * @param angle 角度
             */
            public static getVect2ByAngle(angle: number, dis: number = 1): cc.Vec2 {
                angle = VectorTool.getAbsAngle(angle);
                let x: number;
                let y: number;

                if (angle === 0) { x = 0; y = 0; }
                else if (angle === 90) { x = 0; y = dis; }
                else if (angle === 180) { x = -dis; y = 0; }
                else if (angle === 270) { x = 0; y = -dis; }
                else {
                    x = VectorTool.getSpeedX(dis, angle);
                    y = VectorTool.getSpeedY(dis, angle);
                }

                VectorTool.setVect2(VectorTool.angleV2, x, y);
                return VectorTool.angleV2;
            }
            /**
             * 反射角
             * @param angle 角度 
             * @param dir 向量方向
             */
            public static reflexAngle(angle: number, dir: DirEnum): number {
                let rola: number = 0;
                angle = VectorTool.getAbsAngle(angle);

                switch (dir) {
                    case DirEnum.right:
                        if (angle < 90) {
                            rola = 180 - angle;
                        } else if (angle < 180) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 270) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 360) {
                            rola = 180 + 360 - angle;
                        }
                        break;
                    case DirEnum.rightUp:
                        if (angle < 45) {
                            rola = 225 + (45 - angle);
                        } else if (angle < 90) {
                            rola = 225 - (angle - 45);
                        } else if (angle < 135) {
                            rola = 135 + (135 - angle);
                        } else if (angle < 315) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 360) {
                            rola = 315 - (angle - 315);
                        }
                        break;
                    case DirEnum.up:
                        if (angle < 90) {
                            rola = 360 - angle;
                        } else if (angle < 180) {
                            rola = 360 - angle;
                        } else if (angle < 270) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 360) {
                            // rola = VectorTool.verticalAngle(angle);
                        }
                        break;
                    case DirEnum.leftUp:
                        if (angle < 45) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 90) {
                            rola = 45 - (angle - 45);
                        } else if (angle < 135) {
                            rola = 315 + 135 - angle;
                        } else if (angle < 180) {
                            rola = 315 - (angle - 135);
                        } else if (angle < 225) {
                            rola = 225 + (225 - angle);
                        } else if (angle < 360) {
                            // rola = VectorTool.verticalAngle(angle);
                        }
                        break;
                    case DirEnum.left:
                        if (angle < 90) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 180) {
                            rola = 180 - angle;
                        } else if (angle < 270) {
                            rola = 180 + 360 - angle;
                        } else if (angle < 360) {
                            // rola = VectorTool.verticalAngle(angle);
                        }
                        break;
                    case DirEnum.leftDown:
                        if (angle < 135) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 180) {
                            rola = 135 - (angle - 135);
                        } else if (angle < 225) {
                            rola = 45 + 225 - angle;
                        } else if (angle < 270) {
                            rola = 315 + angle - 135;
                        } else if (angle < 315) {
                            rola = 315 + (315 - angle);
                        } else if (angle < 360) {
                            // rola = VectorTool.verticalAngle(angle);
                        }

                        break;
                    case DirEnum.down:
                        if (angle < 90) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 180) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 270) {
                            rola = 360 - angle;
                        } else if (angle < 360) {
                            rola = 360 - angle;
                        }
                        break;
                    case DirEnum.rightDown:
                        if (angle < 45) {
                            rola = 45 - (angle - 45);
                        } else if (angle < 225) {
                            // rola = VectorTool.verticalAngle(angle);
                        } else if (angle < 270) {
                            rola = 225 - (angle - 225);
                        } else if (angle < 315) {
                            rola = 135 + (315 - angle);
                        } else if (angle < 360) {
                            rola = 135 - (angle - 315);
                        }
                        break;
                    case DirEnum.vertical:
                        rola = VectorTool.verticalAngle(angle);
                        break;
                }
                return rola;
            }
            //对向角
            public static verticalAngle(angle: number): number {
                angle += 180;
                return VectorTool.getAbsAngle(angle);
            }
            //圆形墙对物体反射 枚举
            public static reflexDirEnum(wallPos: cc.Vec2, tarPos: cc.Vec2): DirEnum {
                let angle = VectorTool.getAngleByVect2(tarPos.x - wallPos.x, tarPos.y - wallPos.y);
                if (angle < 30) {
                    return DirEnum.left;
                } else if (angle < 60) {
                    return DirEnum.leftDown;
                } else if (angle < 120) {
                    return DirEnum.down;
                } else if (angle < 150) {
                    return DirEnum.rightDown;
                } else if (angle < 210) {
                    return DirEnum.right;
                } else if (angle < 240) {
                    return DirEnum.rightUp;
                } else if (angle < 300) {
                    return DirEnum.up;
                } else if (angle < 330) {
                    return DirEnum.leftUp;
                } else if (angle < 360) {
                    return DirEnum.left;
                }
                return DirEnum.vertical;
            }
            //----------------------------------------------------------------

            //----------------顺时钟 creator 向量操作
            /**
             * creator 是顺时钟旋转 三角函数是逆时针旋转 角度互换
             * @param _angle 角度           
             */
            private static CCangleOrWise(_angle: number): number {
                return 360 - VectorTool.getAbsAngle(_angle);
            }

            private static posDisV2 = cc.v2();
            /**
             * 两点之间的距离
             * @param _pos1 
             * @param _pos2 
             * @param _bool  false-距离 true-距离平方
             */
            public static twoPosDis(_pos1: cc.Vec2, _pos2: cc.Vec2, _bool: boolean = true): number {
                VectorTool.setVect2(VectorTool.posDisV2, _pos2.x - _pos1.x, _pos2.y - _pos1.y);
                if (_bool)
                    return VectorTool.posDisV2.magSqr();
                else
                    return VectorTool.posDisV2.mag();
            }
            /**
              * 点1 在 点2 范围内 圆形
              * @param _pos1 点1
              * @param _pos2 点2
              * @param _rad 半径
              */
            public static isRange(_pos1: cc.Vec2, _pos2: cc.Vec2, _rad: number = 1): boolean {
                let _isDo = false;
                _isDo = VectorTool.twoPosDis(_pos1, _pos2) < _rad * _rad
                return _isDo;
            }
            /**
             * 点1 在 矩形区域内
             * @param _pos1 
             * @param rectArr 0:-x 1:x 2:-y 3:y
             */
            public static isRect(_pos1: cc.Vec2, rectArr: number[]): boolean {
                return _pos1.x > rectArr[0]
                    && _pos1.x < rectArr[1]
                    && _pos1.y > rectArr[2]
                    && _pos1.y < rectArr[3];
            }


            /**
             * 矩形与园是否相交
             * @param rectPos 
             * @param width 
             * @param high 
             * @param cirPos 
             * @param mRic 
             */
            public static RectIntCir(rectPos: cc.Vec2, width: number, high: number, cirPos: cc.Vec2, mRic: number): boolean {
                let x = Math.min(Math.abs(rectPos.x + width / 2 - cirPos.x), Math.abs(rectPos.x - width / 2 - cirPos.x)); // 矩形四个角中，离圆心近的角，到圆心的x距离
                let y = Math.min(Math.abs(rectPos.y + high / 2 - cirPos.y), Math.abs(rectPos.y - high / 2 - cirPos.y)); // 矩形四个角中，离圆心近的角，到圆心的y距离
                if (x * x + y * y < mRic * mRic * 4) {
                    return true;
                }

                if (Math.abs(rectPos.x - cirPos.x) < ((width + mRic) / 2) && Math.abs(rectPos.y - cirPos.y) < (high / 2)) {
                    return true;
                }
                if (Math.abs(rectPos.y - cirPos.y) < ((high + mRic) / 2) && Math.abs(rectPos.x - cirPos.x) < (width / 2)) {
                    return true;
                }
                return false;
            }
            /**
             * node X轴指向 目标点
             * @param _node 节点
             * @param _vect2 目标点
             */
            public static nodeLookAtPosX(_node: cc.Node, _vect2: cc.Vec2) {
                let x = _vect2.x - _node.position.x;
                let y = _vect2.y - _node.position.y;
                _node.rotation = VectorTool.CCangleOrWise(VectorTool.getAngleByVect2(x, y));
            }
            /**
             * node Y轴指向 目标点
             * @param _node 节点
             * @param _vect2 目标点
             */
            public static nodeLookAtPosY(_node: cc.Node, _vect2: cc.Vec2) {
                let x = _vect2.x - _node.position.x;
                let y = _vect2.y - _node.position.y;
                _node.rotation = VectorTool.CCangleOrWise(VectorTool.getAngleByVect2(x, y) - 90);
            }
            /**
             * 向Y轴方向移动
             * @param _node 
             * @param _dis 
             */
            public static forwardMoveY(node: cc.Node, dis: number) {
                let angleY = node.rotation - 90;
                angleY = angleY == 0 ? 1 : angleY;
                angleY = VectorTool.CCangleOrWise(angleY);
                let vet2Y = VectorTool.getVect2ByAngle(angleY, dis);
                node.x += vet2Y.x;
                node.y += vet2Y.y;
            }
            /**
             * 
             * @param _node 
             * @param _targetPos 
             * @param _dis 分量
             */
            public static orientationMove(_node: cc.Node, _targetPos: cc.Vec2, _dis: number): boolean {

                let res = false;
                let disVet2 = cc.v2(_targetPos.x - _node.x, _targetPos.y - _node.y);
                let disAngle = VectorTool.getAngleByVect2(disVet2.x, disVet2.y);
                if (disVet2.magSqr() < _dis * _dis) {
                    _node.rotation = VectorTool.CCangleOrWise(disAngle + 90);
                    _node.x = _targetPos.x;
                    _node.y = _targetPos.y;
                    return true;
                }
                // console.log('orientationMove1', _node.rotation);

                let raAngle = _dis / disVet2.mag();
                let _nodeAngle = VectorTool.CCangleOrWise(_node.rotation - 90);
                let tarSunAngle = 0;
                if (disAngle > _nodeAngle) {
                    let sunAngle = disAngle - _nodeAngle;
                    if (sunAngle <= 180) {
                        tarSunAngle = sunAngle * raAngle;
                    } else {
                        tarSunAngle = -(360 - sunAngle) * raAngle;
                    }
                } else {
                    let sunAngle = _nodeAngle - disAngle;
                    if (sunAngle <= 180) {
                        tarSunAngle = -sunAngle * raAngle;
                    } else {
                        tarSunAngle = (360 - sunAngle) * raAngle;
                    }
                }
                _node.rotation = VectorTool.CCangleOrWise(_nodeAngle + tarSunAngle - 90);
                // console.log('orientationMove2', _node.rotation);
                // VectorTool.forwardMove(_node, _dis);
                return false;
            }

            private static tarV: cc.Vec2 = new cc.Vec2();
            private static targetPos: cc.Vec2 = new cc.Vec2();
            private static nodePos: cc.Vec2 = new cc.Vec2();
            /**
             * 物体向目标点移动 不做旋转
             * @param _node 物体
             * @param _targetPos 目标点
             * @param _dis 移动距离
             * @param _rad 半径
             */
            public static nodeTranslate(_node: cc.Node, _targetPos: cc.Vec2, _dis: number, _rad: number = 1, doTarget: boolean = true): boolean {
                let _isDo = false;

                VectorTool.setVect2(VectorTool.nodePos, 0, 0, _node.position);
                VectorTool.setVect2(VectorTool.targetPos, 0, 0, _targetPos);
                VectorTool.targetPos.sub(VectorTool.nodePos, VectorTool.tarV);

                if (VectorTool.tarV.magSqr() < _rad * _rad) {
                    if (doTarget) VectorTool.setNodePos(_node, 0, 0, VectorTool.targetPos);
                    _isDo = true;//到达终点
                } else {
                    VectorTool.tarV.normalizeSelf();
                    let reV2 = VectorTool.nodePos.addSelf(VectorTool.tarV.mulSelf(_dis));
                    VectorTool.setNodePos(_node, 0, 0, reV2);
                }

                return _isDo;
            }


            /**
             * 
             * @param midRot 方向角度 Y轴上方向为0
             * @param sumRot 总覆盖角度
             * @param _num 子弹个数
             */
            public static getRotArr(midRot: number, sumRot: number, _num: number): number[] {
                let rotArr: number[] = [];
                let rot = Math.floor(sumRot / _num);
                let minNum = Math.floor(_num / 2);
                for (let i = 0; i < _num; i++) {
                    rotArr.push(midRot + (minNum - i) * rot);
                }
                return rotArr;
            }
            /**
             * 设置node坐标
             * @param node 
             * @param x 
             * @param y 
             * @param v2 
             */
            public static setNodePos(node: cc.Node, x: number, y: number, v2: cc.Vec2 = null) {
                if (v2) {
                    // node.x = v2.x;
                    // node.y = v2.y;
                    node.setPosition(v2.x, v2.y);
                } else {
                    // node.x = x;
                    // node.y = y;
                    node.setPosition(x, y);
                }

            }

            /**
             * 增加 node坐标
             * @param node 
             * @param x 
             * @param y 
             * @param v2 
             */
            public static addNodePos(node: cc.Node, x: number, y: number, v2: cc.Vec2 = null) {
                if (v2) {
                    node.x = node.x + v2.x;
                    node.y = node.y + v2.y;
                } else {
                    node.x = node.x + x;
                    node.y = node.y + y;
                }
            }

            /**
             * 赋值cc.v2
             * @param targetV2 
             * @param x 
             * @param y 
             * @param v2 
             */
            public static setVect2(targetV2: cc.Vec2, x: number, y: number, v2: cc.Vec2 = null) {
                if (v2) {
                    targetV2.x = v2.x;
                    targetV2.y = v2.y;
                } else {
                    targetV2.x = x;
                    targetV2.y = y;
                }
            }
            /**
             * 增加 cc.v2
             * @param targetV2 
             * @param x 
             * @param y 
             * @param v2 
             */
            public static addVect2(targetV2: cc.Vec2, x: number, y: number, v2: cc.Vec2 = null) {
                if (v2) {
                    targetV2.x += v2.x;
                    targetV2.y += v2.y;
                } else {
                    targetV2.x += x;
                    targetV2.y += y;
                }
            }
        }
    }
}

//////////view/GameCD.ts//////////
namespace game {

    export namespace ui {

        export class GameCD {

            private static lastTime: number = 0;

            public static isButtonOk(time = 200) {
                let now = (new Date()).getTime();
                if (now - GameCD.lastTime > time) {
                    GameCD.lastTime = now;
                    return true;
                }
                return false;
            }
        }
    }
}

//////////view/PoolManager.ts//////////
namespace game {

    export namespace ui {
        // import NodePool = cc.NodePool;
        export class PoolManager {
            public static tipNodePool: cc.NodePool = new cc.NodePool();

            public static getTipNode() {
                let node = PoolManager.getPoolNode(PoolManager.tipNodePool, gameLogin.Resource.getResource("tipPrev"))
                return node
            }

            public static pushNode(node: any) {
                PoolManager.tipNodePool.put(node);
            }


            public static getPoolNode(nodePool: cc.NodePool, res: any) {
                var node: cc.Node;
                if (nodePool.size() > 0) {
                    node = nodePool.get();
                } else {
                    var newNode = cc.instantiate(res);
                    nodePool.put(newNode);
                    node = nodePool.get();
                }
                return node;
            }
        }
    }
}

//////////view/DataComponent.ts//////////
namespace game {
    export namespace ui {
        export class DataComponent extends cc.Component {

            private changeList: Array<any> = [];

            addBackground(opacity = 200) {
                let node = new cc.Node();
                this.node.addChild(node);
                let graphics = node.addComponent(cc.Graphics);
                graphics.fillColor = new cc.Color(0, 0, 0, opacity);
                graphics.fillRect(-cc.winSize.width / 2, -cc.winSize.height / 2, cc.winSize.width, cc.winSize.height);
                node.setContentSize(cc.winSize.width, cc.winSize.height);
                node.on(cc.Node.EventType.TOUCH_START, function () {
                }, this, true);
            }

            onValue(value: lib.Value, changeFunction: Function) {
                this.changeList.push([value, changeFunction]);
                value.addListener(lib.Event.CHANGE, changeFunction, this);
            }

            setBtnEnabled(btn: cc.Button, active: boolean) {
                btn.interactable = active;
                btn.enableAutoGrayEffect = !active;
            }

            onDestroy() {
                for (let i = 0; i < this.changeList.length; i++) {
                    this.changeList[i][0].removeListener(lib.Event.CHANGE, this.changeList[i][1], this);
                }
            }

            fringe(node: cc.Node, hight: number) {
                if (G_netdata.b_wxplatform && wx2g_getsystemInfo().screenHeight == 812) {
                    if (!node.getComponent(cc.Widget)) node.addComponent("cc.Widget");
                    let top = node.getComponent(cc.Widget);
                    top.isAlignTop = true;
                    top.top = hight;
                    top.updateAlignment();
                    console.log("iPhone X适配", top.top);

                }
            }

        }
    }
}

//////////view/WxCanvasSprite.ts//////////
namespace game {
    export namespace ui {
        export class WxCanvasSprite extends cc.Sprite {
            private texture: cc.Texture2D;


            onLoad() {
                this.texture = new cc.Texture2D();
            }
            start() {
            }

            updateCanvas(canvas: any) {
                this.clearCanvas();
                if (this.texture == null) {
                    this.texture = new cc.Texture2D();
                }
                this.texture.initWithElement(canvas);
                this.texture.handleLoadedTexture();
                this.spriteFrame = new cc.SpriteFrame();
                this.spriteFrame.setTexture(this.texture);
            }

            clearCanvas() {
                // if(this.texture != null){
                //     this.texture.destroy();
                // }
                if (this.spriteFrame != null) {
                    this.spriteFrame.destroy();
                }
            }
            update(dt: number) {
                if (G_netdata.b_wxplatform) {
                    this.updateCanvas(wx2g_drawNextRank(50, 4));
                }
            }
        }
    }
}



//////////Module tween//////////
//////////QTan.ts//////////
namespace game {
    export namespace tween {

        /**
         * Q弹效果
         */
        export class QTan{

            /***
             * 基础的Q弹效果
             * @param {cc.Node} node
             * @param {number} smallScaleX
             * @param {number} smallScaleY
             * @param {number} bigScaleX
             * @param {number} bigScaleY
             * @param {number} time
             * @param {number} timeGap
             * @param {number} timeGapRandom
             */
            public static normal(node:cc.Node,smallScaleX = 0.88,smallScaleY = 0.88, bigScaleX = 1.12, bigScaleY = 1.22, time = 0.2, timeGap = 2, timeGapRandom = 2):void {
                let scaleX = node.scaleX;
                let scaleY = node.scaleY;
                lib.Tween.to(node,time,{scaleX:smallScaleX * scaleX,scaleY:bigScaleY * scaleY}).delay(timeGap+timeGapRandom*Math.random()).
                to(time, {scaleX:bigScaleX * scaleX,scaleY:smallScaleY * scaleY}).to(time,{scaleX:scaleX,scaleY:scaleY}).timeLine.setLoop(1000000000);
            }
        }
    }
}

//////////Scale.ts//////////
namespace game {
    export namespace tween {

        /**
         * Q弹效果
         */
        export class Scale {

            /***
             * 基础的Q弹效果
             * @param {cc.Node} node
             * @param {number} smallScaleX
             * @param {number} smallScaleY
             * @param {number} bigScaleX
             * @param {number} bigScaleY
             * @param {number} time
             * @param {number} timeGap
             * @param {number} timeGapRandom
             */
            public static bigSmall(node:cc.Node,small = 0.88, big = 1.12, time = 0.4, timeGap = 0.5, timeGapRandom = 0.5):void {
                lib.Tween.to(node,time,{scale:big},{scale:small}).delay(timeGap+timeGapRandom*Math.random()).
                to(time , {scale:small}).timeLine.setLoop(1000000000);
            }

            public static shake(node:cc.Node,rotation=10,time=0.1,timeGap=1,timeGapRandom=1):void {
                lib.Tween.to(node,time,{rotation:rotation}).delay(timeGap + timeGapRandom*Math.random()).to(time*2,{rotation:-rotation}).to(time,{rotation:rotation*0.5}).timeLine.setLoop(100000000);
            }
        }
    }
}



//////////Module layer//////////
//////////view/LayerModule.ts//////////
namespace game {
    export namespace layer {

        export class LayerModule extends mvc.Module {

            private rootNode: cc.Node;

            constructor() {
                super(LayerModule.NAME);
            }

            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE];
            }

            public async handleNotification(note: mvc.Notification) {
                switch (note.name) {
                    case common.Command.INIT_MODULE:
                        var data: common.InitModuleNB = note.body;
                        this.rootNode = new cc.Node();
                        // this.rootNode.x = cc.director.getVisibleSize().width / 2;
                        // this.rootNode.y = cc.director.getVisibleSize().height / 2;
                        data.rootView.addChild(this.rootNode);
                        this.rootNode.addChild(new GameLayer());
                        this.rootNode.addChild(new MainUILayer());
                        this.rootNode.addChild(new PopLayer());
                        this.rootNode.addChild(new TopLayer());
                        break;
                }
            }

            static NAME: string = "layer";
        }
    }
}

//////////view/GameLayer.ts//////////
namespace game {
    export namespace layer {
        export class GameLayer extends cc.Node {

            constructor() {
                super();
                GameLayer.instance = this;
            }

            private static instance: GameLayer;

            public static show(node: cc.Node): void {
                if (node.parent != GameLayer.instance) {
                    GameLayer.instance.addChild(node);
                }
            }
        }
    }
}

//////////view/MainUILayer.ts//////////
namespace game {
    export namespace layer {
        export class MainUILayer extends cc.Node {

            constructor() {
                super();
                MainUILayer.instance = this;
            }

            private static instance: MainUILayer;

            public static show(node: cc.Node): void {
                if (node.parent != MainUILayer.instance) {
                    MainUILayer.instance.addChild(node);
                }
            }
        }
    }
}

//////////view/PopLayer.ts//////////
namespace game {
    export namespace layer {
        export class PopLayer extends cc.Node {

        }
    }
}

//////////view/TopLayer.ts//////////
namespace game {
    export namespace layer {
        export class TopLayer extends cc.Node {
            
            constructor() {
                super();
                TopLayer.instance = this;
            }

            private static instance: TopLayer;

            public static show(node: cc.Node): void {
                if (node.parent != TopLayer.instance) {
                    TopLayer.instance.addChild(node);
                }
            }
        }
    }
}



//////////Module startup//////////
//////////AppFacade.ts//////////
namespace game {

    /**
     * 游戏网络 VBWebsocket
     * @type {null}
     */
    // export var net: any = null;

    // export var net = null;

    export namespace startup {

        export var ModuleName = "startup";
        export var ModuleNone = "";

        export class AppFacade extends mvc.Facade {

            protected initializeController() {
                super.initializeController();

                //cc.director.setDisplayStats(false);

                //注册启动程序
                this.registerCommand(Command.IN.START_UP, StartupCommand);
            }

            /**
             * 启动
             */
            public start(rootView: cc.Node): void {
                //发送启动消息
                this.sendNotification(Command.IN.START_UP, new common.InitModuleNB(rootView, lib.DataManager.createData("ProgressData")));
            }

            public static NAME: string = "gameApp";

            private static instance: AppFacade;

            /**
             * 启动
             */
            public static start(rootView: cc.Node): void {
                if (!AppFacade.instance) {
                    AppFacade.instance = new AppFacade(AppFacade.NAME);
                    AppFacade.instance.start(rootView);
                }
            }
        }
    }
}

//////////controller/Command.ts//////////
namespace game {
    export namespace startup {
        export class Command {
            /**
             * 内部消息
             */
            public static IN = {
                START_UP: "startup.start_up" //启动
            };

            /**
             * 希望外部处理的消息
             */
            public static OUT = {
            };

            /**
             * 处理模块外部的消息
             */
            public static INTERFACE = {
                EXIT: "exit" //退出模块，清除所有模块相关的东西
            };
        }
    }
}

//////////controller/startup/StartupCommand.ts//////////
namespace game {
    export namespace startup {

        export class StartupCommand extends mvc.MacroCommand {

            protected initializeMacroCommand(): void {
                this.addSubCommand(InitModuleCommand);
            }
        }
    }
}

//////////controller/startup/InitModuleCommand.ts//////////
namespace game {
    export namespace startup {

        export class InitModuleCommand extends mvc.SimpleCommand {

            public initModules = [
                new gameLogin.GameLoginModule(),
                new playGame.PlayGameModule(),
                new gameConfig.GameConfigModule(),
                new loading.LoadingModule(),
                new gameStart.GameStartModule(),
            ];

            public commonModules = [
                new layer.LayerModule(),
                new tip.TipModule(),
                new net.NetModule(),

            ];
            public async execute(note: mvc.Notification) {
                for (let i = 0; i < this.commonModules.length; i++) this.facade.registerModule(this.commonModules[i]);
                for (let i = 0; i < this.initModules.length; i++) this.facade.registerModule(this.initModules[i]);

                //获取模块初始化的进度
                var progress = note.body.progress;
                progress.current = progress.max = 1;
                //调用模块初始化消息
                this.sendNotification(common.Command.INIT_MODULE, note.body);
                var max = 1;
                if (progress.percent != max) { //如果模块初始化已完成
                    await progress.percentValue.valueEqual(max);
                }
                this.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("gameLogin"));
            }
        }
    }
}

//////////controller/restart/RestartCommand.ts//////////
namespace game {
    export namespace startup {

        import AppFacade = game.startup.AppFacade;

        export class RestartCommand extends mvc.MacroCommand {

            protected initializeMacroCommand(): void {
                //清理 mvc
                this.addSubCommand(ClearMVCCommand);
                //清理数据模块
                this.addSubCommand(ClearDataCommand);
                //清理 lib 库内容
                this.addSubCommand(ClearLibCommand);

                //启动
                AppFacade.start();
            }
        }
    }
}

//////////controller/restart/ClearMVCCommand.ts//////////
namespace game {
    export namespace startup {
        export class ClearMVCCommand extends mvc.SimpleCommand {

            public execute(note: mvc.Notification): void {
                mvc.Facade.remove(AppFacade.NAME);
                mvc.Model.remove(AppFacade.NAME);
                mvc.View.remove(AppFacade.NAME);
                mvc.Controller.remove(AppFacade.NAME);
            }
        }
    }
}

//////////controller/restart/ClearDataCommand.ts//////////
namespace game {
    export namespace startup {
        export class ClearDataCommand extends mvc.SimpleCommand {

            public execute(note: mvc.Notification): void {
                game.data = null;
            }
        }
    }
}

//////////controller/restart/ClearLibCommand.ts//////////
namespace game {
    export namespace startup {
        export class ClearLibCommand extends mvc.SimpleCommand {

            public execute(note: mvc.Notification): void {

            }
        }
    }
}



//////////Module net//////////
//////////network/Http.ts//////////
namespace game {
    export namespace net {
        export class Http {
            public static key: string = "lkdjfh!@tiantxss";
            public static postRequest(url: string, head: string, data: any, func: Function) {
                data = JSON.stringify(data);
                var xhr = cc.assetManager.getXMLHttpRequest();
                xhr.open("POST", url);
                xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
                xhr.setRequestHeader("Accept", "application/json;charset=UTF-8");
                //xhr.setRequestHeader("aa", "weixin");
                xhr.onreadystatechange = function () {
                    if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status <= 207)) {
                        var response = xhr.response;
                        data = Http.decrypt(response, Http.key);
                        console.log("HTTP:S >>> C--response.POST-->" + head)
                        console.log(data);
                        if (func) {
                            func(data);
                        }
                    } else {
                        if (xhr.readyState == 4) {
                            cc.log("http-->post error...")
                        }
                    }
                };
                xhr.send(data);
                console.log("HTTP:C >>> S--POST-->" + head + "-->" + url)
                console.log(data)
            }

            public static GetRequest(url: string, head: string, data: any, func: Function) {
                var xhr = cc.assetManager.getXMLHttpRequest();
                xhr.open("GET", url, true);
                //xhr.setRequestHeader("aa", "weixin");
                xhr.onreadystatechange = function () {
                    if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 300)) {
                        var response = xhr.responseText
                        data = Http.decrypt(response, Http.key);
                        console.log("HTTP:S >>> C--response.GET-->" + head)
                        console.log(data);
                        if (func) {
                            func(data);
                        }
                    } else {
                        if (xhr.readyState == 2) {
                            // cc.log("http-->get error...")
                            let time = xhr.getResponseHeader("Date");
                            //console.log(xhr.getAllResponseHeaders())
                            G_netdata.t_getservertime = time;
                        }
                    }
                };
                xhr.send(data);
                console.log("HTTP:C >>> S--GET-->" + head + "-->" + url)
                console.log(data)

            }

            public static post_Request(url: string, head: string, data: any, func: Function) {
                var openId = G_netdata.MY_OPENDID
                var const_data: any = { "Gameid": G_netdata.GAME_ID, "Openid": openId };
                var data_sign: any = Object.assign(const_data, data)
                this.postRequest(url, head, data_sign, func);
            }


            public static decrypt(response: any, key: any) {
                return response;
            }

        }
    }
}

//////////network/MyWebSocket.ts//////////
namespace game {
    export namespace net {
        export class MyWebSocket {
            _socket: any = null;
            public connect(url: string, connectFunc: Function = null, errFunc: Function = null, closeFunc: Function = null) {
                var _this = this;
                this._socket = new WebSocket(url);
                this._socket.binaryType = "arraybuffer";
                this._socket.onopen = function (evt: any) {
                    _this.socketOpenHandle(evt);
                    if (connectFunc) {
                        connectFunc();
                    }
                };
                this._socket.onmessage = function (evt: any) {
                    _this.socketMsgHandle(evt);
                };
                this._socket.onerror = function (evt: any) {
                    _this.socketErrorHandle(evt);
                    if (errFunc) {
                        errFunc();
                    }
                };
                this._socket.onclose = function (evt: any) {
                    console.log("断开连接data:" + evt.code)
                    _this.socketCloseHandle(evt);
                    if (closeFunc) {
                        closeFunc();
                    }
                };
            }

            closeconnect() {
                if (this._socket)
                    this._socket.close(4000, "quitroom")
            }

            socketMsgHandle(evt: any) {
                var u8a = new Uint8Array(evt.data);
                var str = this.Uint8ArrayToString(u8a);
                var recvdata = JSON.parse(str);
                console.log("Socket:S >>>> C--------->")
                console.log(recvdata)
                G_netsocket.recvmsgdata(recvdata)
            }

            sendMsg = function (head: string, data: any) {
                if (!this._socket) {
                    return;
                    // throw new Error("没有连接无法发送数据：head=" + head);
                }
                var jsonData = JSON.stringify(data);
                this._socket.send(jsonData);
                console.log("Socket:C >>>>> S----------->" + head)
                console.log(jsonData)
            };

            send_Msg = function (head: string, data: any) {
                var openId = G_netdata.MY_OPENDID;
                var const_data: any = { "Gameid": G_netdata.GAME_ID, "Openid": openId };
                var data_sign: any = Object.assign(const_data, data)
                var last_data: any = {};
                last_data[head] = data_sign
                this.sendMsg(head, last_data)
            }

            socketOpenHandle(evt: any) {
                console.log("socket open...................");
                G_netsocket.b_isconnect = true;
            }
            socketErrorHandle(evt: any) {
                console.log("socket error was fired");
            }
            socketCloseHandle(evt: any) {
                console.log("socket closed..................");
                G_netsocket.b_isconnect = false;
            }

            Uint8ArrayToString(arr: Uint8Array) {
                if (typeof arr === 'string') {
                    return arr;
                }
                var str = '',
                    _arr = arr;
                for (var i = 0; i < _arr.length; i++) {
                    var one = _arr[i].toString(2),
                        v = one.match(/^1+?(?=0)/);
                    if (v && one.length == 8) {
                        var bytesLength = v[0].length;
                        var store = _arr[i].toString(2).slice(7 - bytesLength);
                        for (var st = 1; st < bytesLength; st++) {
                            store += _arr[st + i].toString(2).slice(2);
                        }
                        str += String.fromCharCode(parseInt(store, 2));
                        i += bytesLength - 1;
                    } else {
                        str += String.fromCharCode(_arr[i]);
                    }
                }
                return str;
            }

        }
    }
}

//////////netscript/NetHttp.ts//////////
namespace game {
    export namespace net {
        export class NetHttp extends cc.Component {
            //------登陆----------------------------------------------------------------  
            //请求用户消息并且返回服务器---login界面执行-----在login的短连接（wx2g_login）之后
            public h_getuserinfo(callback: Function) {
                if (G_netdata.b_wxplatform) {
                    if (window.wx2g_userinfo) {
                        if (callback)
                            callback()
                    } else {
                        wx2g_getUserInfo((userInfo: any) => {
                            if (callback) {
                                callback();
                            }
                        })
                    }
                }
            }

            //------检测进入参数----------------------------------------------------------------  
            checkstartparams() {
                console.log("检测微信参数")
                if (window.wx2g_startParams) {
                    var _shareid = wx2g_startParams.query["shareid"]
                    if (_shareid) {
                        console.log("点别人链接进来的")
                    }
                }
            }


            ///上传数据到服务器储存
            public send_GameDataInfo(data: any, func: Function) {
                game.net.Http.post_Request(G_netdata.NET_ADDRESS + "/updateAccExtraData", "updateAccExtraData", data, func);
            }

            send_gamedata2server() {
                if (!G_netdata.b_wxplatform) return

                ///发送
                let data: any = null
                for (var i = cc.sys.localStorage.length - 1; i >= 0; --i) {
                    var key = cc.sys.localStorage.key(i)
                    var _find = false
                    if (game.data.game.hasMember(key)) {
                        _find = true
                    }
                    else if (game.data.playData.hasMember(key)) {
                        _find = true
                    }
                    else if (key.startsWith("selfsmski_") || key.startsWith("selfsmatt_")) {
                        _find = true
                    }
                    if (_find) {
                        var value = cc.sys.localStorage.getItem(key)
                        var temp_data: any = {};
                        temp_data[key] = value
                        data = Object.assign(temp_data, data)
                        //console.log('数据键：' + key + '，数据：' + value);
                    }
                }
                //if ("null"!= data) {
                var send_data: any = { "ExtraData": JSON.stringify(data) };
                G_nethttp.send_GameDataInfo(send_data, function (respon: any) {
                })
                // }
            }


            ///请求账号信息
            public send_getuseraccinfo(callback: Function) {
                if (!G_netdata.b_wxplatform) return

                var url = game.G_netdata.NET_ADDRESS + "/getUserAccInfo?" + "gameid=9" + "&openid=" + G_netdata.MY_OPENDID;
                game.net.Http.GetRequest(url, "getUserAccInfo", {}, function (respone: any) {
                    console.log("拉取用户数据成功");
                    var data = JSON.parse(respone);
                    if (callback)
                        callback(data)
                });
            }

            ///拉取一个服务器的时间
            public send_getservertime() {
                if (!G_netdata.b_wxplatform) return

                var url = G_netdata.NET_ADDRESS + "/getInviteFriendData?gameid=9" + "&openid=" + G_netdata.MY_OPENDID + "&funcType=66";
                game.net.Http.GetRequest(url, "getservertime", {}, function (respone: any) {
                    console.log("获得服务器时间");
                    G_netdata.anyservertime()
                });
            }
        }
    }
    ///
    export var G_nethttp: net.NetHttp = null;
    ///
}


//////////netscript/NetDataEx.ts//////////
namespace game {
    export namespace net {

        export class NetDataEx extends cc.Component {

            ////测试环境和微信开发环境 
            public b_wxplatform: boolean = window.wx2g_login ? true : false;
            ///是不是可充值的安卓平台
            public b_Android: boolean = true;
            //状态栏上边
            public b_iphoneX: boolean = false;

            //https连接地址
            public NET_ADDRESS = this.b_wxplatform ? "https://cc.h5youxi.fun" : "http://192.168.10.104:8080"
            //socket连接地址           
            public LONG_NETADDRESS = this.b_wxplatform ? "wss://cc.h5youxi.fun/wss" : "ws://192.168.10.114/wss"
            //自己的openID 
            public MY_OPENDID = this.b_wxplatform ? "" : "testOpenId11"

            ///游戏ID 
            public GAME_ID: any = "9";

            public w_screenHeight: number = cc.winSize.height
            public w_screenWidth: number = cc.winSize.width

            ///拉取到的服务器时间
            public t_getservertime: any = null
            ///拉取到的服务器时间鹾和本地时间 差值 （s）
            public t_getservertsec_diff: any = 0


            ///得到正确时间 (秒)
            public getcurtime() {
                return Math.floor(Date.now() / 1000) - G_netdata.t_getservertsec_diff
            }


            ///
            anyservertime() {
                if (G_netdata.t_getservertime) {
                    var time = new Date(G_netdata.t_getservertime)
                    console.log("服务器时间 " + time)
                    console.log("本地时间 " + Date.now())
                    //console.log(time.getTime())
                    G_netdata.t_getservertsec_diff = Math.floor((Date.now() - time.getTime()) / 1000)
                    console.log("服务器时间与本地时间秒差值 " + G_netdata.t_getservertsec_diff)
                    if (G_netdata.t_getservertsec_diff < 0) G_netdata.t_getservertsec_diff = 0
                }
                //Sat, 23 Mar 2019 04:18:47 GMT
                //let/let addtime = new Date(lastleavetime.getFullYear(), lastleavetime.getMonth(), lastleavetime.getDate(), 0, 0, 0, 0)
                // let pretime = addtime.getTime() + 86400 * 1000
            }

        }
    }


    ///
    export var G_netdata: net.NetDataEx = null;
    ///
}


//////////netscript/NetSocket.ts//////////
namespace game {
    export namespace net {
        export class NetSocket extends cc.Component {
            _websocket: MyWebSocket;
            //start
            lasttime: number = 0;        ///心跳检测时间
            b_isconnect = false;        ///是否连接

            onLoad() {
                this._websocket = new MyWebSocket()
            }

            update(dt: number) {
                if (this.b_isconnect == false) return;
                var curtimer = Date.now();
                if (curtimer - this.lasttime > 30000) {
                    this.send_heratcheck()
                    this.lasttime = curtimer;
                }
            }

            send_heratcheck() {
                if (this._websocket) {
                    this._websocket.send_Msg("HeartBeatMsg", {})
                    console.log("心跳检测")
                }
            }

            //主动关闭  
            public closesocket() {
                if (this._websocket)
                    this._websocket.closeconnect()
            }

            //处理服务器的rep回执数据
            public recvmsgdata(recvdata: any) {
                ///do something use revedata
                game.data.event.netSocketEvent = recvdata
                // if (recvdata.StartHatch) {
                // }
                // if (recvdata.NotifyOthersToMe) {
                //     var _data = recvdata.NotifyOthersToMe.Data[0]
                //     console.log("有人被邀请进来了")
                //     console.log(_data)
                //     game.data.game.resurgenceNum++
                //     if (this.checknewday()) {
                //         G_netdata.vec_Today_player = []
                //     }
                // }
                // if (recvdata.EnterRoomResp) {
                //     G_netdata.Fuhua_RoomID = recvdata.EnterRoomResp.Roomid

                // }
            }

            // //登陆房间.开始连接
            public s_loginrequest(roomid: number = 0) {
                if (this._websocket) {
                    this._websocket.connect(G_netdata.LONG_NETADDRESS, () => {
                        this.b_isconnect = true
                        this.s_enterhatchRoom(roomid)
                    });
                }
            }

            //进入孵化间
            public s_enterhatchRoom(roomid: number = 0) {
                var nimg: string = window.wx2g_userinfo ? wx2g_userinfo.userInfo.avatarUrl + "?bb=bb.png" : ""
                var nname: string = window.wx2g_userinfo ? wx2g_userinfo.userInfo.nickName : ""
                if (this._websocket) {
                    console.log("进入孵化间 ,房间ID :   " + roomid)
                    var only = roomid > 0 ? true : false
                    var data: any = { "Roomid": roomid, "RoomType": 0, "NickName": nname, "AvatorUrl": nimg, "OnlyNotify": only }
                    this._websocket.send_Msg("EnterRoom", data)
                }
            }


        }

    }


    ///
    export var G_netsocket: net.NetSocket = null;
    ///
}


//////////netscript/GoDateFunc.ts//////////
namespace game {
    export namespace net {
        export class GoDateFunc extends cc.Component {
            /////点击的兑换什么
            public type_duihuan: string = "gold";

            ///记录上次给过来的金币值
            public last_reward_value: number = 0

            ///是否打开分享加钻石的开关
            public openshareadddiamon: boolean = true

            ///是否打开GM开关
            public opengmdebug: boolean = false


            ///关卡数据上传微信
            public writeGameData2wx(vaule: number) {
                if (G_netdata.b_wxplatform)
                    wx2g_uploadRank(vaule)
            }


            /////写入数据
            //type 0. 游戏过程中获得金币    1.金币道具
            public writeRewardGameData(type: number, reward: number, startpos: cc.Vec2 = null) {
                let chazhi = Math.floor((reward - G_func_hand.last_reward_value) / gameStart.getMoreGold.goldbox_getone)
                G_func_hand.last_reward_value = reward
                if (startpos) {
                    gameStart.gamePlayInfo.instance.playani(startpos, reward, chazhi, (type > 0))
                } else {
                    gameStart.gamePlayInfo.instance.showgold(reward)
                }
            }


            public switchopenclose() {
                this.switchsharebool()
                //this.switchgmdebug()
            }


            ///开关 邀请加金币的 
            switchsharebool() {
                if (!G_netdata.b_wxplatform) {
                    this.openshareadddiamon = true
                    return
                }

                this.openshareadddiamon = true
                // let url = "https://img.h5youxi.fun/zgameswitch/canadddiamon.png?time = " + Math.floor(Date.now() / 1000)
                // cc.assetManager.load(url, (err: any, tex: any) => {
                //     if (err) {
                //         this.openshareadddiamon = false
                //     } else {
                //         this.openshareadddiamon = true
                //     }
                // })
            }

            ///开关 gm命令
            switchgmdebug() {
                if (!G_netdata.b_wxplatform) {
                    this.opengmdebug = false
                    return
                }

                // let url = "https://img.h5youxi.fun/zgameswitch/gmdebug.png?time = " + Math.floor(Date.now() / 1000)
                // cc.assetManager.load(url, (err: any, tex: any) => {
                //     if (err) {
                //         this.opengmdebug = false
                //     } else {
                //         this.opengmdebug = true
                //     }
                // })
            }




        }
    }
    ///
    export var G_func_hand: net.GoDateFunc = null;
    ///
}


//////////NetModule.ts//////////
namespace game {
    export namespace net {
        export class MainComponent extends cc.Component {
            onLoad() {
                G_netdata = this.addComponent(NetDataEx)
                G_nethttp = this.addComponent(NetHttp)
                //G_netsocket =  this.addComponent(NetSocket)
                G_func_hand = this.addComponent(GoDateFunc)
            }
        }
        export class NetModule extends mvc.Module {
            viewComponent: any;
            constructor() {
                super("net");
            }
            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE];
            }
            public handleNotification(note: mvc.Notification): void {
                switch (note.name) {
                    case common.Command.INIT_MODULE: //初始化模块
                        {
                            this.viewComponent = new cc.Node();
                            this.viewComponent.addComponent(MainComponent);
                            layer.GameLayer.show(this.viewComponent);
                        }
                }
            }
        }
    }
}



//////////Module loading//////////
//////////view/LoadingModule.ts//////////
namespace game {
    export namespace loading {
        export class LoadingModule extends mvc.Module {

            constructor() {
                super(LoadingModule.NAME);
            }

            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE];
            }

            public handleNotification(note: mvc.Notification): void {
                switch (note.name) {
                    case common.Command.INIT_MODULE: //初始化模块
                        //初始化 view
                        this.facade.registerMediator(new MainMediator());
                        break;
                }
            }

            public static NAME = "loading";
        }
    }
}

//////////view/MainMediator.ts//////////
namespace game {
    export namespace loading {
        export class MainMediator extends mvc.Mediator {

            private bgm: any;
            private data: any;

            constructor() {
                super(MainMediator.NAME, null);
            }

            private initUI(): void {
                this.viewComponent = new LoadingView();
            }

            /**
             * 加载资源
             * @param {Function} resolve
             * @returns {Promise<void>}
             */
            protected async asyncLoad(resolve: Function) {
                super.asyncLoad(resolve);
                this.initUI();
                this.loadComplete();
            }

            public listNotificationInterests(): string[] {
                return [common.Command.OPEN_VIEW, common.Command.CLOSE_VIEW];
            }

            public async handleNotification(note: mvc.Notification) {
                switch (note.name) {
                    case common.Command.OPEN_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        this.data = note.body.data;
                        if (!this.viewComponent) {
                            await this.load();
                        }
                        if(this.viewComponent) {
                            if(!this.viewComponent.parent) {
                                layer.MainUILayer.show(this.viewComponent);
                            }
                            (this.viewComponent as LoadingView).progress = note.body.data.progress;
                            (this.viewComponent as LoadingView).text = note.body.data.text;
                        }
                        break;
                    case common.Command.CLOSE_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (this.viewComponent) {
                            this.viewComponent.destroy();
                            this.viewComponent = null;
                        }
                        cc.audioEngine.stop(this.bgm);
                        break;
                }
            }

            public static NAME = "loading.MainMediator";
        }
    }
}

//////////view/LoadingView.ts//////////
namespace game {
    export namespace loading {
        export class LoadingView extends cc.Node {

            private label: cc.Label;
            private progressSprite: cc.Sprite;
            private progressBgSprite: cc.Sprite;

            constructor() {
                super();
                
                let panel = cc.instantiate(game.prefab.ui0);
                this.addChild(panel);
                this.label = panel.getChildByName("progressTxt").getComponent(cc.Label);

                let sprite = panel.getChildByName("progress").getComponent(cc.Sprite);
                this.progressSprite = sprite;
                new ui.ColorChangeFilter(sprite,0x528bfe);
                sprite = panel.getChildByName("progressbg").getComponent(cc.Sprite);
                this.progressBgSprite = sprite;
                new ui.ColorChangeFilter(sprite,0x52a3fe);
            }

            public set progress(val: number) {
                this.label.string = (~~(val*100)) + "%";
                this.progressSprite.fillRange = val;
                this.progressBgSprite.fillRange = val;
            }

            public set text(val: string) {
                //this.label.string = val;
            }
        }
    }
}



//////////Module gameLogin//////////
//////////proxy/Resource.ts//////////
namespace game {
    export namespace gameLogin {
        export class Resource {

            public static instance: Resource;

            loadList: any[] = [
                { name: "tipPrev", type: "prefab", url: "prefabs/tipPrev" }
            ];

            public static async loadResources() {
                // if(Resource.instance) {
                //     return new Promise<void>(function (resolve: Function) {
                //         resolve();
                //     });
                // }
                Resource.instance = new Resource();
                let list: any[] = Resource.instance.loadList;
                return new Promise<void>(function (resolve: Function) {
                    let index = 0;

                    async function load() {
                        if (index >= list.length) {
                           // mainMediator.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB("loading.MainMediator", {progress:1}));
                            //mainMediator.sendNotification(common.Command.CLOSE_VIEW, new common.CloseViewNB("loading.MainMediator"));
                            resolve();
                            return;
                        }
                        let res = list[index];
                        //mainMediator.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB("loading.MainMediator", {progress:(index / list.length) , text: (~~((index / list.length) * 100)) + "%"}));
                        if (res.data) {
                            index++;
                            load();
                        } else {
                            if (res.type == "URLLoader") {
                                var loader = new lib.URLLoader(res.url);
                                var result = await loader.load();
                                res.data = result.data;
                                index++;
                                load();
                            } else {
                                cc.assetManager.loadRemote(cc.resources.load(res.url), function (e: any, data: any) {
                                    res.data = data;
                                    if(res.type == "plist") {
                                        for(let key in data.frames) {
                                            list.push({
                                                name:key.split(".")[0],
                                                data:data.frames[key]
                                            });
                                        }
                                    }
                                    index++;
                                    if (res.execute) {
                                        res.execute();
                                    }
                                    load();
                                });
                            }
                        }
                    }

                    load();
                }.bind(this));
            }

            public static getResource(name: string): any {
                if(!Resource.instance || !Resource.instance.loadList) return null;
                for (let i = 0; i < Resource.instance.loadList.length; i++) {
                    if (Resource.instance.loadList[i].name == name) {
                        return Resource.instance.loadList[i].data;
                    }
                }
                return null;
            }
        }
    }
}

//////////view/GameLoginModule.ts//////////
namespace game {
    export namespace gameLogin {
        export class GameLoginModule extends mvc.Module {

            constructor() {
                super(GameLoginModule.NAME);
            }

            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE, common.Command.CHANGE_SCENE, common.Command.REGISTER_NET];
            }

            public handleNotification(note: mvc.Notification): void {
                switch (note.name) {
                    case common.Command.INIT_MODULE: //初始化模块
                        // var initData: common.InitModuleNB = note.body;
                        //
                        //初始化 view
                        this.facade.registerMediator(new MainMediator());
                        //
                        // //初始化 model
                        // //1. 加载网络监听对象
                        // this.receiveNetProxies.push(new NoticeCProxy());
                        // this.receiveNetProxies.push(new TestRecvCProxy());
                        // //2. 初始化 proxy
                        //
                        // //初始化 controller
                        // this.facade.registerCommand(Command.IN.AUTO_LOGIN, AutoLoginCommand);
                        // this.facade.registerCommand(Command.IN.LOGIN_GAME_SERVER, LoginCompleteCommand);
                        break;
                    case common.Command.CHANGE_SCENE: //切换场景
                        if (note.body.sceneName == GameLoginModule.NAME) {
                            this.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB(MainMediator.NAME));
                        }
                        break;
                    case common.Command.REGISTER_NET: //注册网络模块
                        // for (let i = 0; i < this.receiveNetProxies.length; i++) {
                        //     this.receiveNetProxies[i].registerNet(game.net);
                        // }
                        break;
                }
            }

            public static NAME = "gameLogin";
        }
    }
}

//////////view/MainMediator.ts//////////
namespace game {
    export namespace gameLogin {
        
        export var mainMediator: MainMediator;

        export class MainMediator extends mvc.Mediator {

            constructor() {
                super(MainMediator.NAME, null);
                mainMediator = this;
            }

            private initUI(): void {
                this.viewComponent = new cc.Node();
                this.viewComponent.addComponent(MainComponent).data = data;
            }

            /**
             * 加载资源
             * @param {Function} resolve
             * @returns {Promise<void>}
             */
            protected async asyncLoad(resolve: Function) {
                super.asyncLoad(resolve);
                await Resource.loadResources();
                this.initUI();
                this.loadComplete();
            }

            public listNotificationInterests(): string[] {
                return [common.Command.OPEN_VIEW, common.Command.CLOSE_VIEW];
            }

            public async handleNotification(note: mvc.Notification) {
                switch (note.name) {
                    case common.Command.OPEN_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (!this.viewComponent) {
                            await this.load();
                        }
                        if (this.viewComponent) {
                            layer.MainUILayer.show(this.viewComponent);
                            // lib.Tween.to(this.viewComponent, 1, {opacity: 255}, null, {opacity: 0});
                        }
                        break;
                    case common.Command.CLOSE_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (this.viewComponent && this.viewComponent.parent) {
                            this.viewComponent.destroy();
                            this.viewComponent = null;
                        }
                        break;
                }
            }

            public static NAME = "gameLogin.MainMediator";
        }
    }
}

//////////view/MainComponent.ts//////////
namespace game {
    export namespace gameLogin {
        export class MainComponent extends cc.Component {
            async onLoad() {
                //获取模块初始化的进度
                var progress = lib.DataManager.createData("ProgressData");
                progress.current = progress.max = 1;
                //调用模块初始化消息
                mainMediator.sendNotification(common.Command.ENTER_GAME_LOADING, progress);
                var max = 1;
                if (progress.percent != max) { //如果模块初始化已完成
                    await progress.percentValue.valueEqual(max);
                }
                this.loginBack();
            }

            loginBack() {
                this.quit();
            }

            quit() {
                ///是否第一次进入游戏 <或者清理过缓存>
                //let checklocal_key = "localplayer"
                //let local_oldplayer = cc.sys.localStorage.getItem(checklocal_key);
                this.start2game("localstart")
     
               // cc.sys.localStorage.setItem(checklocal_key, true);
            }
            //进入游戏界面
            start2game(entertype: string) {
                new gameData.GameDataModule().InitGameData()
                game.data.game.playGameState = HeroStateEnum.none

                ///进入方式
                console.log("entertype " + entertype)

                //关闭进入场景后需要隐藏的场景元素
               // var curscene = cc.director.getScene()
                //if (curscene) {
                 //   curscene.getChildByName("RootView").getChildByName("needhide").active = false
               // }

                //声音 
                game.data.game.soundstate = true

                ///开始冒险吧!~~~
                //mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("playGame"));
                setTimeout(() => {
                    mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("gameStart"));
                }, 200);

            }

            // log_save_local() {
            //     ///看下存档
            //     for (var i = cc.sys.localStorage.length - 1; i >= 0; --i) {
            //         var key = cc.sys.localStorage.key(i)
            //         var value = cc.sys.localStorage.getItem(key)
            //         console.log('数据键：' + key + '，数据：' + value);
            //     }
            // }
        }
    }

}



//////////Module gameStart//////////
//////////proxy/Resource.ts//////////
namespace game {
    export namespace gameStart {
        export class Resource {

            public static instance: Resource;

            loadList: any[] = [
                { name: "ui", type: "prefab", url: "prefabs/start" }
            ];

            public static async loadResources() {
                if(Resource.instance) {
                    return new Promise<void>(function (resolve: Function) {
                        resolve();
                    });
                }
                Resource.instance = new Resource();
                let list: any[] = Resource.instance.loadList;
                return new Promise<void>(function (resolve: Function) {
                    let index = 0;

                    async function load() {
                        if (index >= list.length) {
                            //mainMediator.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB("loading.MainMediator", {progress:1}));
                            //mainMediator.sendNotification(common.Command.CLOSE_VIEW, new common.CloseViewNB("loading.MainMediator"));
                            resolve();
                            return;
                        }
                        let res = list[index];
                       // mainMediator.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB("loading.MainMediator", {progress:(index / list.length) , text: (~~((index / list.length) * 100)) + "%"}));
                        if (res.data) {
                            index++;
                            load();
                        } else {
                            if (res.type == "URLLoader") {
                                var loader = new lib.URLLoader(res.url);
                                var result = await loader.load();
                                res.data = result.data;
                                index++;
                                load();
                            } else {
                                cc.assetManager.loadAny(cc.resources.load(res.url), function (e: any, data: any) {
                                    res.data = data;
                                    index++;
                                    if (res.execute) {
                                        res.execute();
                                    }
                                    load();
                                });
                            }
                        }
                    }

                    load();
                }.bind(this));
            }

            public static getResource(name: string): any {
                if(!Resource.instance || !Resource.instance.loadList) return null;
                for (let i = 0; i < Resource.instance.loadList.length; i++) {
                    if (Resource.instance.loadList[i].name == name) {
                        return Resource.instance.loadList[i].data;
                    }
                }
                return null;
            }
        }
    }
}

//////////view/GameStartModule.ts//////////
namespace game {
    export namespace gameStart {
        export class GameStartModule extends mvc.Module {

            constructor() {
                super(GameStartModule.NAME);
            }

            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE, common.Command.CHANGE_SCENE, common.Command.REGISTER_NET];
            }

            public handleNotification(note: mvc.Notification): void {
                switch (note.name) {
                    case common.Command.INIT_MODULE: //初始化模块
                        // var initData: common.InitModuleNB = note.body;
                        //
                        //初始化 view
                        this.facade.registerMediator(new MainMediator());
                        //
                        // //初始化 model
                        // //1. 加载网络监听对象
                        // this.receiveNetProxies.push(new NoticeCProxy());
                        // this.receiveNetProxies.push(new TestRecvCProxy());
                        // //2. 初始化 proxy
                        //
                        // //初始化 controller
                        // this.facade.registerCommand(Command.IN.AUTO_LOGIN, AutoLoginCommand);
                        // this.facade.registerCommand(Command.IN.LOGIN_GAME_SERVER, LoginCompleteCommand);
                        break;
                    case common.Command.CHANGE_SCENE: //切换场景
                        if (note.body.sceneName == GameStartModule.NAME) {
                            this.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB(MainMediator.NAME));
                        }
                        break;
                    case common.Command.REGISTER_NET: //注册网络模块
                        // for (let i = 0; i < this.receiveNetProxies.length; i++) {
                        //     this.receiveNetProxies[i].registerNet(game.net);
                        // }
                        break;
                }
            }

            public static NAME = "gameStart";
        }
    }
}

//////////view/MainMediator.ts//////////
namespace game {
    export namespace gameStart {
        
        export var mainMediator: MainMediator;

        export class MainMediator extends mvc.Mediator {

            constructor() {
                super(MainMediator.NAME, null);
                mainMediator = this;
            }

            private initUI(): void {
                this.viewComponent = new cc.Node();
                this.viewComponent.addComponent(MainComponent).data = data;
            }

            /**
             * 加载资源
             * @param {Function} resolve
             * @returns {Promise<void>}
             */
            protected async asyncLoad(resolve: Function) {
                super.asyncLoad(resolve);
                await Resource.loadResources();
                this.initUI();
                this.loadComplete();
            }

            public listNotificationInterests(): string[] {
                return [common.Command.OPEN_VIEW, common.Command.CLOSE_VIEW];
            }

            public async handleNotification(note: mvc.Notification) {
                switch (note.name) {
                    case common.Command.OPEN_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (!this.viewComponent) {
                            await this.load();
                        }
                        if (this.viewComponent) {
                            layer.MainUILayer.show(this.viewComponent)
                            this.viewComponent.name = "gameStart!";
                            // lib.Tween.to(this.viewComponent, 1, {opacity: 255}, null, {opacity: 0});
                        }
                        break;
                    case common.Command.CLOSE_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (this.viewComponent && this.viewComponent.parent) {
                            this.viewComponent.destroy(true);
                            this.viewComponent = null;
                        }
                        break;
                }
            }

            public static NAME = "gameStart.MainMediator";
        }
    }
}

//////////view/MainComponent.ts//////////
namespace game {
    export namespace gameStart {
        export class MainComponent extends cc.Component {

            private panel:cc.Node;
            private isActive:boolean = true;
            public static first = true;

            onLoad() {
                // ui.NumberComponent.textures = [];
                // for (let i = 0; i < 10; i++) {
                //     ui.NumberComponent.textures.push(Resource.getResource("" + i));
                // }

                // this.node.addChild(this.panel = cc.instantiate(Resource.getResource("ui")));
                // this.panel.setContentSize(cc.director.getWinSize().width,cc.director.getWinSize().height);

                // let node = new cc.Node();
                // this.panel.getChildByName("tipNode").getChildByName("shape").addChild(node);
                // let graphics = node.addComponent(cc.Graphics);
                // graphics.fillColor = new cc.Color(0,0,0,200);
                // graphics.fillRect(0,0,cc.director.getWinSize().width,cc.director.getWinSize().height);
                // node.setContentSize(cc.director.getWinSize().width,cc.director.getWinSize().height);
                // node.on(cc.Node.EventType.TOUCH_START,function(){
                // },this,true);
                // this.panel.getChildByName("tipNode").getChildByName("closeApp").on(cc.Node.EventType.TOUCH_END, this.closeTip,this);
                // if(game.data.loginDay == 2) {
                //     this.panel.getChildByName("tipNode").active = true;
                //     this.panel.getChildByName("tipNode").setContentSize(cc.director.getWinSize().width,cc.director.getWinSize().height);
                // }

                // this.panel.getChildByName("mid").getChildByName("bestScore").addComponent(wx.BestScore);
                // this.panel.getChildByName("mid").getChildByName("rankIndex").addComponent(wx.RankIndex);
                // if(MainComponent.first) {
                //     MainComponent.first = false;
                //     setTimeout(function () {
                //         if(!this.isActive) return;
                //         this.panel.getChildByName("mid").getChildByName("bestScore").getComponent(wx.BestScore).flush();
                //         this.panel.getChildByName("mid").getChildByName("rankIndex").getComponent(wx.RankIndex).flush();
                //     }.bind(this),1000);
                //     setTimeout(function () {
                //         if(!this.isActive) return;
                //         this.panel.getChildByName("mid").getChildByName("bestScore").getComponent(wx.BestScore).flush();
                //         this.panel.getChildByName("mid").getChildByName("rankIndex").getComponent(wx.RankIndex).flush();
                //     }.bind(this),2000);
                //     setTimeout(function () {
                //         if(!this.isActive) return;
                //         this.panel.getChildByName("mid").getChildByName("bestScore").getComponent(wx.BestScore).flush();
                //         this.panel.getChildByName("mid").getChildByName("rankIndex").getComponent(wx.RankIndex).flush();
                //     }.bind(this),3000);
                //     setTimeout(function () {
                //         if(!this.isActive) return;
                //         this.panel.getChildByName("mid").getChildByName("bestScore").getComponent(wx.BestScore).flush();
                //         this.panel.getChildByName("mid").getChildByName("rankIndex").getComponent(wx.RankIndex).flush();
                //     }.bind(this),4000);
                //     setTimeout(function () {
                //         if(!this.isActive) return;
                //         this.panel.getChildByName("mid").getChildByName("bestScore").getComponent(wx.BestScore).flush();
                //         this.panel.getChildByName("mid").getChildByName("rankIndex").getComponent(wx.RankIndex).flush();
                //     }.bind(this),5000);
                // }

                // // this.panel.getChildByName("boxBtn").addComponent(ui.ButtonShakeComponent);

                // this.panel.getChildByName("soundOnBtn").getComponent(cc.Widget).top = ui.Fix.getTop();
                // this.panel.getChildByName("soundOffBtn").getComponent(cc.Widget).top = ui.Fix.getTop();

                // this.panel.getChildByName("startBtn").on(cc.Node.EventType.TOUCH_END, this.onStart, this);
                // this.panel.getChildByName("shareBtn").on(cc.Node.EventType.TOUCH_END, this.onShare, this);
                // this.panel.getChildByName("rankBtn").on(cc.Node.EventType.TOUCH_END, this.onShowRank, this);
                // this.panel.getChildByName("soundOnBtn").on(cc.Node.EventType.TOUCH_END, this.clickMusicOn, this);
                // this.panel.getChildByName("soundOffBtn").on(cc.Node.EventType.TOUCH_END, this.clickMusicOff, this);
                // // this.panel.getChildByName("challengeBtn").on(cc.Node.EventType.TOUCH_END, gameShare.Share.share);
                // // this.panel.getChildByName("shareBtn").on(cc.Node.EventType.TOUCH_END, gameShare.Share.share);
                // this.panel.getChildByName("inviteBtn").on(cc.Node.EventType.TOUCH_END, gameShare.Share.share,this);
                // this.panel.getChildByName("moreBtn").on(cc.Node.EventType.TOUCH_END, this.clickMore,this);
                // this.panel.getChildByName("more2Btn").on(cc.Node.EventType.TOUCH_END, this.clickMore2,this);
                // //点击箱子
                // this.panel.getChildByName("boxBtn").on(cc.Node.EventType.TOUCH_END, this.clickBox,this);
                // this.panel.getChildByName("shouBtn").on(cc.Node.EventType.TOUCH_END, this.clickShou,this);
                // this.panel.getChildByName("boxBtn").active = game.data.shareOpen;

                // this.isActive = true;

                // new lib.Binding((this.panel.getChildByName("lifeTxt") as cc.Node).getComponent(cc.Label), [], "string", "{data.wxplatform}");

                // var boxNode:cc.Node = playBox.GameBoxComponent.add(this.node,0,0).setBoxTexture(Resource.getResource("box"));
                // boxNode.on(cc.Node.EventType.TOUCH_END, this.onShowBox, this);
            }
            // onShowBox(){
            //     mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("PlayBox"));
            // }

            update() {
                // this.panel.getChildByName("light2").rotation += 1;
            }
        }
    }
}



//////////Module gameConfig//////////
//////////utils/CSV.ts//////////
namespace game {
    export namespace gameConfig {
        export class CSV {
            //"name,value\r\nmonsterEnterTime,\"400,500\"\r\ntipStartTime,300\r\ntipEndTime,500\r\ntipGapTime,500\r\noperateSrartTime,500\r\noperateEndTime,500\r\nmonsterExitTime,500\r\nlevelGapTime,500\r\ngameOverLevel,5\r\nperfectTime,100\r\ngoodTime,200\r\nmissTime,300\r\ntipHandTime,200\r\ntipEffectTime,200\r\nfaceChangeTime,500\r\n"
            public static Parse(content: string): Array<Array<string>> {
                let list: Array<Array<string>> = new Array<Array<string>>();
                content = lib.StringDo.replaceString(content, '\r', '\n');
                content = lib.StringDo.replaceString(content, "\n\n", '\n');
                let array: Array<string> = content.split('\n');
                for (let i = 0, len = array.length; i < len; i++) {
                    let start = 0;
                    let end = start;
                    let special = false;
                    let rowStr = array[i];
                    if (rowStr.length == 0) continue;
                    let row = new Array<string>();
                    list.push(row);
                    for (let c = 0, clen = array[i].length; c < clen; c++) {
                        if (rowStr[c] == '"') {
                            if (special == false) {
                                special = true;
                                start = c + 1;
                                end = start;
                            }
                            else {
                                if (c + 1 < clen && rowStr[c + 1] == '"') {
                                    c++;
                                    end++;
                                }
                                else {
                                    if (c == clen - 1) {
                                        row.push(rowStr.slice(start, end));
                                    }
                                    special = false;
                                }
                            }
                        }
                        else if (rowStr[c] == ',') {
                            if (!special) {
                                row.push(rowStr.slice(start, end));
                                start = c + 1;
                                end = start;
                            }
                            else {
                                end++;
                            }
                        }
                        else {
                            end++;
                            if (c == clen - 1) {
                                row.push(rowStr.slice(start, end));
                            }
                        }
                    }
                }
                return list;
            }
        }
    }
}

//////////proxy/Resource.ts//////////
namespace game {
    export namespace gameConfig {
        export class Resource {

            public static instance: Resource;

            loadList: any[] = [
            ];

            public static async loadResources() {
                if (Resource.instance) {
                    return new Promise<void>(function (resolve: Function) {
                        resolve();
                    });
                }
                Resource.instance = new Resource();
                Resource.instance.loadList = Resource.instance.loadList.concat(ConfigDecode.resources);
                let list: any[] = Resource.instance.loadList;
                return new Promise<void>(function (resolve: Function) {
                    let index = 0;
                    async function load() {
                        if (index >= list.length) {
                            resolve();
                            return;
                        }
                        let res = list[index];
                        if (res.data) {
                            index++;
                            load();
                        } else {
                            cc.assetManager.loadRes(res.url, function (e: any, data: any) {
                                // console.log('gameConfig', res.url, e, data);
                                res.data = data;
                                index++;
                                if (res.execute) {
                                    res.execute();
                                }
                                load();
                            });
                        }
                    }

                    load();
                }.bind(this));
            }

            public static getResource(name: string): any {
                for (let i = 0; i < Resource.instance.loadList.length; i++) {
                    if (Resource.instance.loadList[i].name == name) {
                        return Resource.instance.loadList[i].data;
                    }
                }
                return null;
            }
        }
    }
}

//////////view/GameConfigModule.ts//////////
namespace game {

    export namespace gameConfig {

        export class GameConfigModule extends mvc.Module {

            constructor() {
                super(GameConfigModule.NAME);
                module = this;
            }

            public listNotificationInterests(): string[] {
                return [common.Command.ENTER_GAME_LOADING];
            }

            public async handleNotification(note: mvc.Notification) {
                switch (note.name) {
                    case common.Command.ENTER_GAME_LOADING: //初始化模块
                        let progress = note.body;
                        progress.max++;
                        await Resource.loadResources();
                        ConfigDecode.init();
                        progress.current++;
                        // console.log('gameConfig', ConfigDecode.resources);
                        break;
                }
            }

            public static NAME = "gameConfig";
        }
        export var module: GameConfigModule = null;
    }
}

//////////proxy/vo/config/GoodsInfo.ts//////////
//Make By CSVCommand. Time 2020.9.6 19:4:22
namespace game {
	export namespace gameConfig {
		export class GoodsInfo {

			private list:Array<string>;
			public id:number;
			public Name:string;
			public iconName:string;
			public IconType:number;
			public goodsType:number;
			public value:number;
			public DropRate:number;
			public LevelLimit:string;
			public Des:string;

			public Decode(list:Array<string>):void
			{
				this.list = list;
				for(let i = 0; i < list.length; i++)
				{
					if(i == 0)
					{
						this.id = ~~this.list[0];
					}
					if(i == 1)
					{
						this.Name = this.list[1];
					}
					if(i == 2)
					{
						this.iconName = this.list[2];
					}
					if(i == 3)
					{
						this.IconType = ~~this.list[3];
					}
					if(i == 4)
					{
						this.goodsType = ~~this.list[4];
					}
					if(i == 5)
					{
						this.value = ~~this.list[5];
					}
					if(i == 6)
					{
						this.DropRate = ~~this.list[6];
					}
					if(i == 7)
					{
						this.LevelLimit = this.list[7];
					}
					if(i == 8)
					{
						this.Des = this.list[8];
					}
				}
			}

			public DecodeConfigItem():void
			{
				for (let i = 0; i < this.list.length; i++)
				{
				}
				this.list = null;
			}


			public static Configs:Array<GoodsInfo> = new Array<GoodsInfo>();

			public static GetConfig(key:number):GoodsInfo
			{
				for(let i = 0,list = GoodsInfo.Configs; i < list.length; i++)
				{
					if(list[i].id == key)
					{
						return list[i];
					}
				}
				return null;
			}

			public static DecodeTable(str:string):void
			{
				let configs = GoodsInfo.Configs;
				configs.length = 0;
				str = lib.StringDo.replaceString(str, '\r', '\n');
				str = lib.StringDo.replaceString(str, "\n\n", '\n');
				var list:Array<Array<string>> = CSV.Parse(str);
				if(!GoodsInfo.isType(list[0][0])) list.splice(0,1);
				for(let i = 2,len = list.length; i < len; i++)
				{
					let item= new GoodsInfo();
					item.Decode(list[i]);
					configs.push(item);
				}
			}

			public static GetConfigWidth(paramName:string,value:any):GoodsInfo
			{
				for (let i = 0,configs = GoodsInfo.Configs; i < configs.length; i++)
				{
					let val = (configs[i] as any)[paramName];
					let flag = false;
					if (typeof val == "string")
					{
						flag = value == val ? true : false;
					}
					else
					{
						flag = val == value;
					}
					if (flag)
					{
						return configs[i];
					}
				}
				return null;
			}

			public static isType(str:string):boolean {
				if(str[0] == '(')
				{
					str = str.slice(str.indexOf(')') + 1,str.length)
					if(str == 'int' || str == 'number' || str == 'string') return true
				}
				if(str.slice(0,'Array'.length) == 'Array')
				{
					str = str.slice('Array('.length,str.length-1);
					if(str == 'int' || str == 'number' || str == 'string') return true;
				}
				if(str == 'int' || str == 'number' || str == 'string') return true;
				return false;
			}
N			public static DecodeTableItem():void
			{
				for(let i = 0,len = GoodsInfo.Configs.length; i < len; i++)
				{
					GoodsInfo.Configs[i].DecodeConfigItem();
				}
			}

		}
	}
}

//////////proxy/vo/config/HelpCfg.ts//////////
//Make By CSVCommand. Time 2020.9.6 19:4:22
namespace game {
	export namespace gameConfig {
		export class HelpCfg {

			private list:Array<string>;
			public id:number;
			public name:string;
			public spName:string;
			public bulletName:string;
			public atvLevel:number;

			public Decode(list:Array<string>):void
			{
				this.list = list;
				for(let i = 0; i < list.length; i++)
				{
					if(i == 0)
					{
						this.id = ~~this.list[0];
					}
					if(i == 1)
					{
						this.name = this.list[1];
					}
					if(i == 2)
					{
						this.spName = this.list[2];
					}
					if(i == 3)
					{
						this.bulletName = this.list[3];
					}
					if(i == 4)
					{
						this.atvLevel = ~~this.list[4];
					}
				}
			}

			public DecodeConfigItem():void
			{
				for (let i = 0; i < this.list.length; i++)
				{
				}
				this.list = null;
			}


			public static Configs:Array<HelpCfg> = new Array<HelpCfg>();

			public static GetConfig(key:number):HelpCfg
			{
				for(let i = 0,list = HelpCfg.Configs; i < list.length; i++)
				{
					if(list[i].id == key)
					{
						return list[i];
					}
				}
				return null;
			}

			public static DecodeTable(str:string):void
			{
				let configs = HelpCfg.Configs;
				configs.length = 0;
				str = lib.StringDo.replaceString(str, '\r', '\n');
				str = lib.StringDo.replaceString(str, "\n\n", '\n');
				var list:Array<Array<string>> = CSV.Parse(str);
				if(!HelpCfg.isType(list[0][0])) list.splice(0,1);
				for(let i = 2,len = list.length; i < len; i++)
				{
					let item= new HelpCfg();
					item.Decode(list[i]);
					configs.push(item);
				}
			}

			public static GetConfigWidth(paramName:string,value:any):HelpCfg
			{
				for (let i = 0,configs = HelpCfg.Configs; i < configs.length; i++)
				{
					let val = (configs[i] as any)[paramName];
					let flag = false;
					if (typeof val == "string")
					{
						flag = value == val ? true : false;
					}
					else
					{
						flag = val == value;
					}
					if (flag)
					{
						return configs[i];
					}
				}
				return null;
			}

			public static isType(str:string):boolean {
				if(str[0] == '(')
				{
					str = str.slice(str.indexOf(')') + 1,str.length)
					if(str == 'int' || str == 'number' || str == 'string') return true
				}
				if(str.slice(0,'Array'.length) == 'Array')
				{
					str = str.slice('Array('.length,str.length-1);
					if(str == 'int' || str == 'number' || str == 'string') return true;
				}
				if(str == 'int' || str == 'number' || str == 'string') return true;
				return false;
			}
N			public static DecodeTableItem():void
			{
				for(let i = 0,len = HelpCfg.Configs.length; i < len; i++)
				{
					HelpCfg.Configs[i].DecodeConfigItem();
				}
			}

		}
	}
}

//////////proxy/vo/config/HeroLevel.ts//////////
//Make By CSVCommand. Time 2020.9.6 19:4:22
namespace game {
	export namespace gameConfig {
		export class HeroLevel {

			private list:Array<string>;
			public id:number;
			public atk:number;
			public atkPrice:number;
			public atkspeed:number;
			public bulNum:number;
			public speedPrice:number;

			public Decode(list:Array<string>):void
			{
				this.list = list;
				for(let i = 0; i < list.length; i++)
				{
					if(i == 0)
					{
						this.id = ~~this.list[0];
					}
					if(i == 1)
					{
						this.atk = ~~this.list[1];
					}
					if(i == 2)
					{
						this.atkPrice = ~~this.list[2];
					}
					if(i == 3)
					{
						this.atkspeed = ~~this.list[3];
					}
					if(i == 4)
					{
						this.bulNum = ~~this.list[4];
					}
					if(i == 5)
					{
						this.speedPrice = ~~this.list[5];
					}
				}
			}

			public DecodeConfigItem():void
			{
				for (let i = 0; i < this.list.length; i++)
				{
				}
				this.list = null;
			}


			public static Configs:Array<HeroLevel> = new Array<HeroLevel>();

			public static GetConfig(key:number):HeroLevel
			{
				for(let i = 0,list = HeroLevel.Configs; i < list.length; i++)
				{
					if(list[i].id == key)
					{
						return list[i];
					}
				}
				return null;
			}

			public static DecodeTable(str:string):void
			{
				let configs = HeroLevel.Configs;
				configs.length = 0;
				str = lib.StringDo.replaceString(str, '\r', '\n');
				str = lib.StringDo.replaceString(str, "\n\n", '\n');
				var list:Array<Array<string>> = CSV.Parse(str);
				if(!HeroLevel.isType(list[0][0])) list.splice(0,1);
				for(let i = 2,len = list.length; i < len; i++)
				{
					let item= new HeroLevel();
					item.Decode(list[i]);
					configs.push(item);
				}
			}

			public static GetConfigWidth(paramName:string,value:any):HeroLevel
			{
				for (let i = 0,configs = HeroLevel.Configs; i < configs.length; i++)
				{
					let val = (configs[i] as any)[paramName];
					let flag = false;
					if (typeof val == "string")
					{
						flag = value == val ? true : false;
					}
					else
					{
						flag = val == value;
					}
					if (flag)
					{
						return configs[i];
					}
				}
				return null;
			}

			public static isType(str:string):boolean {
				if(str[0] == '(')
				{
					str = str.slice(str.indexOf(')') + 1,str.length)
					if(str == 'int' || str == 'number' || str == 'string') return true
				}
				if(str.slice(0,'Array'.length) == 'Array')
				{
					str = str.slice('Array('.length,str.length-1);
					if(str == 'int' || str == 'number' || str == 'string') return true;
				}
				if(str == 'int' || str == 'number' || str == 'string') return true;
				return false;
			}
N			public static DecodeTableItem():void
			{
				for(let i = 0,len = HeroLevel.Configs.length; i < len; i++)
				{
					HeroLevel.Configs[i].DecodeConfigItem();
				}
			}

		}
	}
}

//////////proxy/vo/config/LevelCfg.ts//////////
//Make By CSVCommand. Time 2020.9.6 19:4:22
namespace game {
	export namespace gameConfig {
		export class LevelCfg {

			private list:Array<string>;
			public id:number;
			public bossId:number;
			public limitPower:number;
			public awardGold:number;
			public awardPower:number;
			public goods:string;
			public sumGold:number;
			public p1Hp:string;
			public p1Scale:string;
			public p1Lv:string;
			public p1Id:string;
			public p1RdId:string;
			public p2Hp:string;
			public p2Scale:string;
			public p2Lv:string;
			public p2Id:string;
			public p2RdId:string;
			public p3Hp:string;
			public p3Scale:string;
			public p3Lv:string;
			public p3Id:string;
			public p3RdId:string;
			public isDiff:number;

			public Decode(list:Array<string>):void
			{
				this.list = list;
				for(let i = 0; i < list.length; i++)
				{
					if(i == 0)
					{
						this.id = ~~this.list[0];
					}
					if(i == 1)
					{
						this.bossId = ~~this.list[1];
					}
					if(i == 2)
					{
						this.limitPower = ~~this.list[2];
					}
					if(i == 3)
					{
						this.awardGold = ~~this.list[3];
					}
					if(i == 4)
					{
						this.awardPower = ~~this.list[4];
					}
					if(i == 5)
					{
						this.goods = this.list[5];
					}
					if(i == 6)
					{
						this.sumGold = ~~this.list[6];
					}
					if(i == 7)
					{
						this.p1Hp = this.list[7];
					}
					if(i == 8)
					{
						this.p1Scale = this.list[8];
					}
					if(i == 9)
					{
						this.p1Lv = this.list[9];
					}
					if(i == 10)
					{
						this.p1Id = this.list[10];
					}
					if(i == 11)
					{
						this.p1RdId = this.list[11];
					}
					if(i == 12)
					{
						this.p2Hp = this.list[12];
					}
					if(i == 13)
					{
						this.p2Scale = this.list[13];
					}
					if(i == 14)
					{
						this.p2Lv = this.list[14];
					}
					if(i == 15)
					{
						this.p2Id = this.list[15];
					}
					if(i == 16)
					{
						this.p2RdId = this.list[16];
					}
					if(i == 17)
					{
						this.p3Hp = this.list[17];
					}
					if(i == 18)
					{
						this.p3Scale = this.list[18];
					}
					if(i == 19)
					{
						this.p3Lv = this.list[19];
					}
					if(i == 20)
					{
						this.p3Id = this.list[20];
					}
					if(i == 21)
					{
						this.p3RdId = this.list[21];
					}
					if(i == 22)
					{
						this.isDiff = ~~this.list[22];
					}
				}
			}

			public DecodeConfigItem():void
			{
				for (let i = 0; i < this.list.length; i++)
				{
				}
				this.list = null;
			}


			public static Configs:Array<LevelCfg> = new Array<LevelCfg>();

			public static GetConfig(key:number):LevelCfg
			{
				for(let i = 0,list = LevelCfg.Configs; i < list.length; i++)
				{
					if(list[i].id == key)
					{
						return list[i];
					}
				}
				return null;
			}

			public static DecodeTable(str:string):void
			{
				let configs = LevelCfg.Configs;
				configs.length = 0;
				str = lib.StringDo.replaceString(str, '\r', '\n');
				str = lib.StringDo.replaceString(str, "\n\n", '\n');
				var list:Array<Array<string>> = CSV.Parse(str);
				if(!LevelCfg.isType(list[0][0])) list.splice(0,1);
				for(let i = 2,len = list.length; i < len; i++)
				{
					let item= new LevelCfg();
					item.Decode(list[i]);
					configs.push(item);
				}
			}

			public static GetConfigWidth(paramName:string,value:any):LevelCfg
			{
				for (let i = 0,configs = LevelCfg.Configs; i < configs.length; i++)
				{
					let val = (configs[i] as any)[paramName];
					let flag = false;
					if (typeof val == "string")
					{
						flag = value == val ? true : false;
					}
					else
					{
						flag = val == value;
					}
					if (flag)
					{
						return configs[i];
					}
				}
				return null;
			}

			public static isType(str:string):boolean {
				if(str[0] == '(')
				{
					str = str.slice(str.indexOf(')') + 1,str.length)
					if(str == 'int' || str == 'number' || str == 'string') return true
				}
				if(str.slice(0,'Array'.length) == 'Array')
				{
					str = str.slice('Array('.length,str.length-1);
					if(str == 'int' || str == 'number' || str == 'string') return true;
				}
				if(str == 'int' || str == 'number' || str == 'string') return true;
				return false;
			}
N			public static DecodeTableItem():void
			{
				for(let i = 0,len = LevelCfg.Configs.length; i < len; i++)
				{
					LevelCfg.Configs[i].DecodeConfigItem();
				}
			}

		}
	}
}

//////////proxy/vo/config/ConfigDecode.ts//////////
namespace game {
    export namespace gameConfig {
        export class ConfigDecode {

        	public static resources = [
				{name: "GoodsInfo",url:"resources/gameConfig/res/GoodsInfo.csv"},
				{name: "HelpCfg",url:"resources/gameConfig/res/HelpCfg.csv"},
				{name: "HeroLevel",url:"resources/gameConfig/res/HeroLevel.csv"},
				{name: "LevelCfg",url:"resources/gameConfig/res/LevelCfg.csv"}
			];

        	public static init() {
				GoodsInfo.DecodeTable(Resource.getResource("GoodsInfo") + "");
				HelpCfg.DecodeTable(Resource.getResource("HelpCfg") + "");
				HeroLevel.DecodeTable(Resource.getResource("HeroLevel") + "");
				LevelCfg.DecodeTable(Resource.getResource("LevelCfg") + "");
				GoodsInfo.DecodeTableItem();
				HelpCfg.DecodeTableItem();
				HeroLevel.DecodeTableItem();
				LevelCfg.DecodeTableItem();
			}
        }
    }
}



//////////Module gameData//////////
//////////GameDataModule.ts//////////
namespace game {
    export namespace gameData {

        export class GameDataModule extends mvc.Module {

            constructor() {
                super(GameDataModule.NAME);
            }

            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE];
            }

            public handleNotification(note: mvc.Notification): void {
                switch (note.name) {
                    case common.Command.INIT_MODULE: //初始化模块
                        this.InitGameData();
                        break;
                }
            }

            public InitGameData() {
                lib.ObjectValue.save = this.save;
                lib.ObjectValue.read = this.read;
                lib.Binding.addBindingCheck(game);
                game.data = lib.DataManager.createData("game.gameData.Main");
                lib.Binding.addBindingCheck(game.data);
                game.data.checkAllBinding();
            }


            save(type: string, name: string, value: any) {
                if (type) {
                    cc.sys.localStorage.setItem(name, value);
                }
            }

            read(type: string, name: string): any {
                if (type) {
                    return cc.sys.localStorage.getItem(name) || "";
                }
                return "";
            }


            public static NAME = "gameData";
        }
    }

    export var data: gameData.Main = null;
}

//////////data/Bag.ts//////////
namespace game {
    export namespace gameData {

        export class Bag extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "Bag";
				this.$setMember("coin" , new lib.IntValue(null,null,undefined));
				this.coinValue.addListener(lib.Event.CHANGE,function () {if(this.save) this.save("native","coin",this.coin)},this);
				if(this.read) this.coin = this.read("native","coin");
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			get coinValue():lib.Value { return this.__value["coin"]; }

			get coin():number {
				return this.__value["coin"].value;
			}

			set coin(val:number) {
				this.setValue("coin", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(Bag,"game.gameData.Bag");
        
    }
    
    
}




//////////data/Event.ts//////////
namespace game {
    export namespace gameData {

        export class Event extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "Event";
				this.$setMember("testEventWithParams" , new lib.AnyValue(null));
				this.$setMember("testEventNoParams" , new lib.IntValue(null,null,undefined));
				this.$setMember("netSocketEvent" , new lib.AnyValue(null));
				this.$setMember("hideplaydlg" , new lib.AnyValue(null));
				this.$setMember("lvuphero" , new lib.AnyValue(null));
				this.$setMember("lvupsmall" , new lib.AnyValue(null));
				this.$setMember("lvupgoldbox" , new lib.AnyValue(null));
				this.$setMember("goldchangeoutgame" , new lib.AnyValue(null));
				this.$setMember("needplaybgani" , new lib.AnyValue(null));
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			/**
			 * 测试事件，带参数，抛事件  game.data.event.testEventWithParams = xxx;
			 * @returns {any}
			 */
			get testEventWithParamsValue():lib.Value { return this.__value["testEventWithParams"]; }

			/**
			 * 测试事件，带参数，抛事件  game.data.event.testEventWithParams = xxx;
			 * @returns {any}
			 */
			get testEventWithParams():any {
				return this.__value["testEventWithParams"].value;
			}

			/**
			 * 测试事件，带参数，抛事件  game.data.event.testEventWithParams = xxx;
			 * @param {any}
			 */
			set testEventWithParams(val:any) {
				this.setValue("testEventWithParams", val);
			}

			/**
			 * 测试事件，不带参数，抛事件  game.data.event.testEventNoParams++; 或者 game.data.event.testEventNoParams.dispatchWith(lib.Event.CHANGE)
			 * @returns {number}
			 */
			get testEventNoParamsValue():lib.Value { return this.__value["testEventNoParams"]; }

			/**
			 * 测试事件，不带参数，抛事件  game.data.event.testEventNoParams++; 或者 game.data.event.testEventNoParams.dispatchWith(lib.Event.CHANGE)
			 * @returns {number}
			 */
			get testEventNoParams():number {
				return this.__value["testEventNoParams"].value;
			}

			/**
			 * 测试事件，不带参数，抛事件  game.data.event.testEventNoParams++; 或者 game.data.event.testEventNoParams.dispatchWith(lib.Event.CHANGE)
			 * @param {number}
			 */
			set testEventNoParams(val:number) {
				this.setValue("testEventNoParams", val);
			}

			/**
			 * 服务器网络事件
			 * @returns {any}
			 */
			get netSocketEventValue():lib.Value { return this.__value["netSocketEvent"]; }

			/**
			 * 服务器网络事件
			 * @returns {any}
			 */
			get netSocketEvent():any {
				return this.__value["netSocketEvent"].value;
			}

			/**
			 * 服务器网络事件
			 * @param {any}
			 */
			set netSocketEvent(val:any) {
				this.setValue("netSocketEvent", val);
			}

			/**
			 * 关闭玩家属性升级界面
			 * @returns {any}
			 */
			get hideplaydlgValue():lib.Value { return this.__value["hideplaydlg"]; }

			/**
			 * 关闭玩家属性升级界面
			 * @returns {any}
			 */
			get hideplaydlg():any {
				return this.__value["hideplaydlg"].value;
			}

			/**
			 * 关闭玩家属性升级界面
			 * @param {any}
			 */
			set hideplaydlg(val:any) {
				this.setValue("hideplaydlg", val);
			}

			/**
			 * 主飞机升级
			 * @returns {any}
			 */
			get lvupheroValue():lib.Value { return this.__value["lvuphero"]; }

			/**
			 * 主飞机升级
			 * @returns {any}
			 */
			get lvuphero():any {
				return this.__value["lvuphero"].value;
			}

			/**
			 * 主飞机升级
			 * @param {any}
			 */
			set lvuphero(val:any) {
				this.setValue("lvuphero", val);
			}

			/**
			 * 副僚机升级
			 * @returns {any}
			 */
			get lvupsmallValue():lib.Value { return this.__value["lvupsmall"]; }

			/**
			 * 副僚机升级
			 * @returns {any}
			 */
			get lvupsmall():any {
				return this.__value["lvupsmall"].value;
			}

			/**
			 * 副僚机升级
			 * @param {any}
			 */
			set lvupsmall(val:any) {
				this.setValue("lvupsmall", val);
			}

			/**
			 * 金币收益宝箱升级
			 * @returns {any}
			 */
			get lvupgoldboxValue():lib.Value { return this.__value["lvupgoldbox"]; }

			/**
			 * 金币收益宝箱升级
			 * @returns {any}
			 */
			get lvupgoldbox():any {
				return this.__value["lvupgoldbox"].value;
			}

			/**
			 * 金币收益宝箱升级
			 * @param {any}
			 */
			set lvupgoldbox(val:any) {
				this.setValue("lvupgoldbox", val);
			}

			/**
			 * 主界面金币发生改变
			 * @returns {any}
			 */
			get goldchangeoutgameValue():lib.Value { return this.__value["goldchangeoutgame"]; }

			/**
			 * 主界面金币发生改变
			 * @returns {any}
			 */
			get goldchangeoutgame():any {
				return this.__value["goldchangeoutgame"].value;
			}

			/**
			 * 主界面金币发生改变
			 * @param {any}
			 */
			set goldchangeoutgame(val:any) {
				this.setValue("goldchangeoutgame", val);
			}

			/**
			 * 需要播放屏幕震动动画
			 * @returns {any}
			 */
			get needplaybganiValue():lib.Value { return this.__value["needplaybgani"]; }

			/**
			 * 需要播放屏幕震动动画
			 * @returns {any}
			 */
			get needplaybgani():any {
				return this.__value["needplaybgani"].value;
			}

			/**
			 * 需要播放屏幕震动动画
			 * @param {any}
			 */
			set needplaybgani(val:any) {
				this.setValue("needplaybgani", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(Event,"game.gameData.Event");
        
    }
    
    
}




//////////data/Game.ts//////////
namespace game {
    export namespace gameData {

        export class Game extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "Game";
				this.$setMember("gold" , new lib.IntValue(null,null,undefined));
				this.goldValue.addListener(lib.Event.CHANGE,function () {if(this.save) this.save("native","gold",this.gold)},this);
				if(this.read) this.gold = this.read("native","gold");
				this.$setMember("diamond" , new lib.IntValue(null,null,undefined));
				this.diamondValue.addListener(lib.Event.CHANGE,function () {if(this.save) this.save("native","diamond",this.diamond)},this);
				if(this.read) this.diamond = this.read("native","diamond");
				this.$setMember("power" , new lib.IntValue(null,null,undefined));
				this.powerValue.addListener(lib.Event.CHANGE,function () {if(this.save) this.save("native","power",this.power)},this);
				if(this.read) this.power = this.read("native","power");
				this.$setMember("soundstate" , new lib.BooleanValue(true,null));
				this.soundstateValue.addListener(lib.Event.CHANGE,function () {if(this.save) this.save("native","soundstate",this.soundstate)},this);
				if(this.read) this.soundstate = this.read("native","soundstate");
				this.$setMember("shakestate" , new lib.BooleanValue(true,null));
				this.shakestateValue.addListener(lib.Event.CHANGE,function () {if(this.save) this.save("native","shakestate",this.shakestate)},this);
				if(this.read) this.shakestate = this.read("native","shakestate");
				this.$setMember("curHeroId" , new lib.IntValue(null,null,undefined));
				this.curHeroIdValue.addListener(lib.Event.CHANGE,function () {if(this.save) this.save("native","curHeroId",this.curHeroId)},this);
				if(this.read) this.curHeroId = this.read("native","curHeroId");
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			/**
			 * 拥有的金币
			 * @returns {number}
			 */
			get goldValue():lib.Value { return this.__value["gold"]; }

			/**
			 * 拥有的金币
			 * @returns {number}
			 */
			get gold():number {
				return this.__value["gold"].value;
			}

			/**
			 * 拥有的金币
			 * @param {number}
			 */
			set gold(val:number) {
				this.setValue("gold", val);
			}

			/**
			 * 拥有的钻石
			 * @returns {number}
			 */
			get diamondValue():lib.Value { return this.__value["diamond"]; }

			/**
			 * 拥有的钻石
			 * @returns {number}
			 */
			get diamond():number {
				return this.__value["diamond"].value;
			}

			/**
			 * 拥有的钻石
			 * @param {number}
			 */
			set diamond(val:number) {
				this.setValue("diamond", val);
			}

			/**
			 * 拥有的体力
			 * @returns {number}
			 */
			get powerValue():lib.Value { return this.__value["power"]; }

			/**
			 * 拥有的体力
			 * @returns {number}
			 */
			get power():number {
				return this.__value["power"].value;
			}

			/**
			 * 拥有的体力
			 * @param {number}
			 */
			set power(val:number) {
				this.setValue("power", val);
			}

			/**
			 * 背景音乐打开
			 * @returns {boolean}
			 */
			get soundstateValue():lib.Value { return this.__value["soundstate"]; }

			/**
			 * 背景音乐打开
			 * @returns {boolean}
			 */
			get soundstate():boolean {
				return this.__value["soundstate"].value;
			}

			/**
			 * 背景音乐打开
			 * @param {boolean}
			 */
			set soundstate(val:boolean) {
				this.setValue("soundstate", val);
			}

			/**
			 * 射击震动打开
			 * @returns {boolean}
			 */
			get shakestateValue():lib.Value { return this.__value["shakestate"]; }

			/**
			 * 射击震动打开
			 * @returns {boolean}
			 */
			get shakestate():boolean {
				return this.__value["shakestate"].value;
			}

			/**
			 * 射击震动打开
			 * @param {boolean}
			 */
			set shakestate(val:boolean) {
				this.setValue("shakestate", val);
			}

			/**
			 * 当前使用的英雄id
			 * @returns {number}
			 */
			get curHeroIdValue():lib.Value { return this.__value["curHeroId"]; }

			/**
			 * 当前使用的英雄id
			 * @returns {number}
			 */
			get curHeroId():number {
				return this.__value["curHeroId"].value;
			}

			/**
			 * 当前使用的英雄id
			 * @param {number}
			 */
			set curHeroId(val:number) {
				this.setValue("curHeroId", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(Game,"game.gameData.Game");
        
    }
    
    
}




//////////data/Main.ts//////////
namespace game {
    export namespace gameData {

        export class Main extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "Main";
				this.$setMember("event" , lib.DataManager.getInstance().createData("game.gameData.Event",null));
				this.$setMemberSaveClass("event" ,false);
				this.$setMember("game" , lib.DataManager.getInstance().createData("game.gameData.Game",null));
				this.$setMemberSaveClass("game" ,false);
				this.$setMember("tipsArr" , new lib.ArrayValue(null,"game.gameData.TipsMessage"));
				this.$setMember("gainArr" , new lib.ArrayValue(null,"GainMessage"));
				this.$setMember("skillCef" , lib.DataManager.getInstance().createData("SkillCef",null));
				this.$setMemberSaveClass("skillCef" ,false);
				this.$setMember("playData" , lib.DataManager.getInstance().createData("game.gameData.PlayData",null));
				this.$setMemberSaveClass("playData" ,false);
				this.$setMember("conNum" , lib.DataManager.getInstance().createData("ConNum",null));
				this.$setMemberSaveClass("conNum" ,false);
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			/**
			 * 全局事件
			 * @returns {game.gameData.Event}
			 */
			get eventValue():lib.Value { return this.__value["event"]; }

			/**
			 * 全局事件
			 * @returns {game.gameData.Event}
			 */
			get event():game.gameData.Event {
				return this.__value["event"];
			}

			/**
			 * 全局事件
			 * @param {game.gameData.Event}
			 */
			set event(val:game.gameData.Event) {
				this.setValue("event", val);
			}

			get gameValue():lib.Value { return this.__value["game"]; }

			get game():game.gameData.Game {
				return this.__value["game"];
			}

			set game(val:game.gameData.Game) {
				this.setValue("game", val);
			}

			/**
			 * 提示信息队列
			 * @returns {lib.ArrayValue}
			 */
			get tipsArrValue():lib.Value { return this.__value["tipsArr"]; }

			/**
			 * 提示信息队列
			 * @returns {lib.ArrayValue}
			 */
			get tipsArr():lib.ArrayValue {
				return this.__value["tipsArr"];
			}

			/**
			 * 提示信息队列
			 * @param {lib.ArrayValue}
			 */
			set tipsArr(val:lib.ArrayValue) {
				this.setValue("tipsArr", val);
			}

			/**
			 * 获得物品列表
			 * @returns {lib.ArrayValue}
			 */
			get gainArrValue():lib.Value { return this.__value["gainArr"]; }

			/**
			 * 获得物品列表
			 * @returns {lib.ArrayValue}
			 */
			get gainArr():lib.ArrayValue {
				return this.__value["gainArr"];
			}

			/**
			 * 获得物品列表
			 * @param {lib.ArrayValue}
			 */
			set gainArr(val:lib.ArrayValue) {
				this.setValue("gainArr", val);
			}

			/**
			 * 技能相关数据
			 * @returns {SkillCef}
			 */
			get skillCefValue():lib.Value { return this.__value["skillCef"]; }

			/**
			 * 技能相关数据
			 * @returns {SkillCef}
			 */
			get skillCef():SkillCef {
				return this.__value["skillCef"];
			}

			/**
			 * 技能相关数据
			 * @param {SkillCef}
			 */
			set skillCef(val:SkillCef) {
				this.setValue("skillCef", val);
			}

			/**
			 * 关卡游戏数据
			 * @returns {game.gameData.PlayData}
			 */
			get playDataValue():lib.Value { return this.__value["playData"]; }

			/**
			 * 关卡游戏数据
			 * @returns {game.gameData.PlayData}
			 */
			get playData():game.gameData.PlayData {
				return this.__value["playData"];
			}

			/**
			 * 关卡游戏数据
			 * @param {game.gameData.PlayData}
			 */
			set playData(val:game.gameData.PlayData) {
				this.setValue("playData", val);
			}

			/**
			 * 游戏中常量数据
			 * @returns {ConNum}
			 */
			get conNumValue():lib.Value { return this.__value["conNum"]; }

			/**
			 * 游戏中常量数据
			 * @returns {ConNum}
			 */
			get conNum():ConNum {
				return this.__value["conNum"];
			}

			/**
			 * 游戏中常量数据
			 * @param {ConNum}
			 */
			set conNum(val:ConNum) {
				this.setValue("conNum", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(Main,"game.gameData.Main");
        
    }
    
    
}




//////////data/PlayData.ts//////////
namespace game {
    export namespace gameData {

        export class PlayData extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "PlayData";
				this.$setMember("curBulletSpr" , new lib.StringValue("",null));
				this.$setMember("isPlay" , new lib.BooleanValue(true,null));
				this.$setMember("isFighting" , new lib.BooleanValue(false,null));
				this.$setMember("isCanMove" , new lib.BooleanValue(false,null));
				this.$setMember("curGoldNum" , new lib.NumberValue(0,null,undefined));
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			/**
			 * 当前子弹图片路径
			 * @returns {string}
			 */
			get curBulletSprValue():lib.Value { return this.__value["curBulletSpr"]; }

			/**
			 * 当前子弹图片路径
			 * @returns {string}
			 */
			get curBulletSpr():string {
				return this.__value["curBulletSpr"].value;
			}

			/**
			 * 当前子弹图片路径
			 * @param {string}
			 */
			set curBulletSpr(val:string) {
				this.setValue("curBulletSpr", val);
			}

			/**
			 * 游戏开始/暂停
			 * @returns {boolean}
			 */
			get isPlayValue():lib.Value { return this.__value["isPlay"]; }

			/**
			 * 游戏开始/暂停
			 * @returns {boolean}
			 */
			get isPlay():boolean {
				return this.__value["isPlay"].value;
			}

			/**
			 * 游戏开始/暂停
			 * @param {boolean}
			 */
			set isPlay(val:boolean) {
				this.setValue("isPlay", val);
			}

			/**
			 * 战斗状态 子弹是否生成
			 * @returns {boolean}
			 */
			get isFightingValue():lib.Value { return this.__value["isFighting"]; }

			/**
			 * 战斗状态 子弹是否生成
			 * @returns {boolean}
			 */
			get isFighting():boolean {
				return this.__value["isFighting"].value;
			}

			/**
			 * 战斗状态 子弹是否生成
			 * @param {boolean}
			 */
			set isFighting(val:boolean) {
				this.setValue("isFighting", val);
			}

			/**
			 * 英雄可以移动
			 * @returns {boolean}
			 */
			get isCanMoveValue():lib.Value { return this.__value["isCanMove"]; }

			/**
			 * 英雄可以移动
			 * @returns {boolean}
			 */
			get isCanMove():boolean {
				return this.__value["isCanMove"].value;
			}

			/**
			 * 英雄可以移动
			 * @param {boolean}
			 */
			set isCanMove(val:boolean) {
				this.setValue("isCanMove", val);
			}

			/**
			 * 本局获得金币
			 * @returns {number}
			 */
			get curGoldNumValue():lib.Value { return this.__value["curGoldNum"]; }

			/**
			 * 本局获得金币
			 * @returns {number}
			 */
			get curGoldNum():number {
				return this.__value["curGoldNum"].value;
			}

			/**
			 * 本局获得金币
			 * @param {number}
			 */
			set curGoldNum(val:number) {
				this.setValue("curGoldNum", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(PlayData,"game.gameData.PlayData");
        
    }
    
    
}




//////////data/Setting.ts//////////
namespace game {
    export namespace gameData {

        export class Setting extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "Setting";
				this.$setMember("shareOpen" , new lib.BooleanValue(null,null));
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			get shareOpenValue():lib.Value { return this.__value["shareOpen"]; }

			get shareOpen():boolean {
				return this.__value["shareOpen"].value;
			}

			set shareOpen(val:boolean) {
				this.setValue("shareOpen", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(Setting,"game.gameData.Setting");
        
    }
    
    
}




//////////data/Test.ts//////////
namespace game {
    export namespace gameData {

        export class Test extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "Test";
				this.$setMember("num" , new lib.IntValue(null,null,undefined));
				this.$setMember("num2" , new lib.NumberValue(null,null,undefined));
				this.$setMember("max" , new lib.NumberValue(null,null,undefined));
				this.$setMember("str" , new lib.StringValue(null,null));
				this.$setMember("list" , new lib.ArrayValue(null,"int"));
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }
				this.bindings.push(new lib.Binding(this.maxValue,[this],"value","{num>num2?num:num2}"));

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			/**
			 * 整数
			 * @returns {number}
			 */
			get numValue():lib.Value { return this.__value["num"]; }

			/**
			 * 整数
			 * @returns {number}
			 */
			get num():number {
				return this.__value["num"].value;
			}

			/**
			 * 整数
			 * @param {number}
			 */
			set num(val:number) {
				this.setValue("num", val);
			}

			/**
			 * 数字
			 * @returns {number}
			 */
			get num2Value():lib.Value { return this.__value["num2"]; }

			/**
			 * 数字
			 * @returns {number}
			 */
			get num2():number {
				return this.__value["num2"].value;
			}

			/**
			 * 数字
			 * @param {number}
			 */
			set num2(val:number) {
				this.setValue("num2", val);
			}

			/**
			 * 测试绑定数字
			 * @returns {number}
			 */
			get maxValue():lib.Value { return this.__value["max"]; }

			/**
			 * 测试绑定数字
			 * @returns {number}
			 */
			get max():number {
				return this.__value["max"].value;
			}

			/**
			 * 测试绑定数字
			 * @param {number}
			 */
			set max(val:number) {
				this.setValue("max", val);
			}

			/**
			 * 字符串
			 * @returns {string}
			 */
			get strValue():lib.Value { return this.__value["str"]; }

			/**
			 * 字符串
			 * @returns {string}
			 */
			get str():string {
				return this.__value["str"].value;
			}

			/**
			 * 字符串
			 * @param {string}
			 */
			set str(val:string) {
				this.setValue("str", val);
			}

			/**
			 * 数字数组
			 * @returns {lib.ArrayValue}
			 */
			get listValue():lib.Value { return this.__value["list"]; }

			/**
			 * 数字数组
			 * @returns {lib.ArrayValue}
			 */
			get list():lib.ArrayValue {
				return this.__value["list"];
			}

			/**
			 * 数字数组
			 * @param {lib.ArrayValue}
			 */
			set list(val:lib.ArrayValue) {
				this.setValue("list", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(Test,"game.gameData.Test");
        
    }
    
    
}




//////////data/TipsMessage.ts//////////
namespace game {
    export namespace gameData {

        export class TipsMessage extends lib.ObjectValue {
            constructor(init:any = null) {
                super();
                this.className = "TipsMessage";
				this.$setMember("btnNum" , new lib.IntValue(null,null,undefined));
				this.$setMember("titleStr" , new lib.StringValue(null,null));
				this.$setMember("tipsStr" , new lib.StringValue(null,null));
				this.$setMember("OkCallFun" , lib.DataManager.getInstance().createData("Function",null));
				this.$setMemberSaveClass("OkCallFun" ,false);
				this.$setMember("OkStr" , new lib.StringValue(null,null));
				this.$setMember("CancelCallFun" , lib.DataManager.getInstance().createData("Function",null));
				this.$setMemberSaveClass("CancelCallFun" ,false);
				this.$setMember("CancelStr" , new lib.StringValue(null,null));
				this.$setMember("goodsIcon" , new lib.StringValue(null,null));
				this.$setMember("goodsDes" , new lib.StringValue(null,null));
				if(init) this.value = init;
				this.$addPropertyBinding();

            }
            
            private bindings:Array<lib.Binding>;
            $addPropertyBinding() {
                if(super.$addPropertyBinding) {
                    super.$addPropertyBinding();
                } else {
                    if(!this.bindings) this.bindings = [];
                    for(let i = 0; i < this.bindings.length; i++) this.bindings[i].dispose();
                    this.bindings.length = 0;
                }

            }
            
            checkAllBinding() {
            	this.$addPropertyBinding();
            	for(let key in this.__value) {
            		if(this.__value[key] && this.__value[key].checkAllBinding) this.__value[key].checkAllBinding();
				}
			}
        
			/**
			 * 显示按钮数量 1 只有确定按钮 2返回和确定
			 * @returns {number}
			 */
			get btnNumValue():lib.Value { return this.__value["btnNum"]; }

			/**
			 * 显示按钮数量 1 只有确定按钮 2返回和确定
			 * @returns {number}
			 */
			get btnNum():number {
				return this.__value["btnNum"].value;
			}

			/**
			 * 显示按钮数量 1 只有确定按钮 2返回和确定
			 * @param {number}
			 */
			set btnNum(val:number) {
				this.setValue("btnNum", val);
			}

			/**
			 * 标头描述
			 * @returns {string}
			 */
			get titleStrValue():lib.Value { return this.__value["titleStr"]; }

			/**
			 * 标头描述
			 * @returns {string}
			 */
			get titleStr():string {
				return this.__value["titleStr"].value;
			}

			/**
			 * 标头描述
			 * @param {string}
			 */
			set titleStr(val:string) {
				this.setValue("titleStr", val);
			}

			/**
			 * 内容描述文字
			 * @returns {string}
			 */
			get tipsStrValue():lib.Value { return this.__value["tipsStr"]; }

			/**
			 * 内容描述文字
			 * @returns {string}
			 */
			get tipsStr():string {
				return this.__value["tipsStr"].value;
			}

			/**
			 * 内容描述文字
			 * @param {string}
			 */
			set tipsStr(val:string) {
				this.setValue("tipsStr", val);
			}

			/**
			 * OK回调
			 * @returns {Function}
			 */
			get OkCallFunValue():lib.Value { return this.__value["OkCallFun"]; }

			/**
			 * OK回调
			 * @returns {Function}
			 */
			get OkCallFun():Function {
				return this.__value["OkCallFun"];
			}

			/**
			 * OK回调
			 * @param {Function}
			 */
			set OkCallFun(val:Function) {
				this.setValue("OkCallFun", val);
			}

			/**
			 * OK按钮名字
			 * @returns {string}
			 */
			get OkStrValue():lib.Value { return this.__value["OkStr"]; }

			/**
			 * OK按钮名字
			 * @returns {string}
			 */
			get OkStr():string {
				return this.__value["OkStr"].value;
			}

			/**
			 * OK按钮名字
			 * @param {string}
			 */
			set OkStr(val:string) {
				this.setValue("OkStr", val);
			}

			/**
			 * Cancel回调
			 * @returns {Function}
			 */
			get CancelCallFunValue():lib.Value { return this.__value["CancelCallFun"]; }

			/**
			 * Cancel回调
			 * @returns {Function}
			 */
			get CancelCallFun():Function {
				return this.__value["CancelCallFun"];
			}

			/**
			 * Cancel回调
			 * @param {Function}
			 */
			set CancelCallFun(val:Function) {
				this.setValue("CancelCallFun", val);
			}

			/**
			 * Cancel按钮名字
			 * @returns {string}
			 */
			get CancelStrValue():lib.Value { return this.__value["CancelStr"]; }

			/**
			 * Cancel按钮名字
			 * @returns {string}
			 */
			get CancelStr():string {
				return this.__value["CancelStr"].value;
			}

			/**
			 * Cancel按钮名字
			 * @param {string}
			 */
			set CancelStr(val:string) {
				this.setValue("CancelStr", val);
			}

			/**
			 * 物品图片路径
			 * @returns {string}
			 */
			get goodsIconValue():lib.Value { return this.__value["goodsIcon"]; }

			/**
			 * 物品图片路径
			 * @returns {string}
			 */
			get goodsIcon():string {
				return this.__value["goodsIcon"].value;
			}

			/**
			 * 物品图片路径
			 * @param {string}
			 */
			set goodsIcon(val:string) {
				this.setValue("goodsIcon", val);
			}

			/**
			 * 物品描述
			 * @returns {string}
			 */
			get goodsDesValue():lib.Value { return this.__value["goodsDes"]; }

			/**
			 * 物品描述
			 * @returns {string}
			 */
			get goodsDes():string {
				return this.__value["goodsDes"].value;
			}

			/**
			 * 物品描述
			 * @param {string}
			 */
			set goodsDes(val:string) {
				this.setValue("goodsDes", val);
			}


        }
        
        lib.DataManager.getInstance().$addClassDefine(TipsMessage,"game.gameData.TipsMessage");
        
    }
    
    
}






//////////Module playGame//////////
//////////proxy/Resource.ts//////////
namespace game {
    export namespace playGame {
        export class Resource {

            public static instance: Resource;

            loadList: any[] = [
                {name: "ui", data: game.prefab.ui11},
            ];

            public static async loadResources() {
                // if(Resource.instance) {
                //     return new Promise<void>(function (resolve: Function) {
                //         resolve();
                //     });
                // }
                Resource.instance = new Resource();
                let list: any[] = Resource.instance.loadList;
                return new Promise<void>(function (resolve: Function) {
                    let index = 0;

                    async function load() {
                        if (index >= list.length) {
                            //mainMediator.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB("loading.MainMediator", {progress:1}));
                            //mainMediator.sendNotification(common.Command.CLOSE_VIEW, new common.CloseViewNB("loading.MainMediator"));
                            resolve();
                            return;
                        }
                        let res = list[index];
                        //mainMediator.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB("loading.MainMediator", {progress:(index / list.length) , text: (~~((index / list.length) * 100)) + "%"}));
                        if (res.data) {
                            index++;
                            load();
                        } else if(res.atlas) {
                            if(!res.atlas._spriteFrames[res.atlasName]) console.log(res.atlasName)
                            res.data = (res.atlas._spriteFrames[res.atlasName] as cc.SpriteFrame);
                            load();
                        } else {
                            if (res.type == "URLLoader") {
                                var loader = new lib.URLLoader(res.url);
                                var result = await loader.load();
                                res.data = result.data;
                                index++;
                                load();
                            } else {
                                cc.assetManager.load(cc.resources.load(res.url), function (e: any, data: any) {
                                    res.data = data;
                                    index++;
                                    if (res.execute) {
                                        res.execute();
                                    }
                                    load();
                                });
                            }
                        }
                    }

                    load();
                }.bind(this));
            }

            public static getResource(name: string): any {
                if(!Resource.instance || !Resource.instance.loadList) return null;
                for (let i = 0; i < Resource.instance.loadList.length; i++) {
                    if (Resource.instance.loadList[i].name == name) {
                        return Resource.instance.loadList[i].data;
                    }
                }
                return null;
            }
        }
    }
}

//////////view/PlayGameModule.ts//////////
namespace game {
    export namespace playGame {
        export class PlayGameModule extends mvc.Module {

            constructor() {
                super(PlayGameModule.NAME);
            }

            public listNotificationInterests(): string[] {
                return [common.Command.INIT_MODULE, common.Command.CHANGE_SCENE, common.Command.REGISTER_NET];
            }

            public handleNotification(note: mvc.Notification): void {
                switch (note.name) {
                    case common.Command.INIT_MODULE: //初始化模块
                        // game.staticData = new StaticData();
                        //game.staticData = lib.DataManager.createData("game.playGame.StaticData");
                        //game.staticData.createMap();
                        // var initData: common.InitModuleNB = note.body;
                        //
                        //初始化 view
                        this.facade.registerMediator(new MainMediator());
                        //
                        // //初始化 model
                        // //1. 加载网络监听对象
                        // this.receiveNetProxies.push(new NoticeCProxy());
                        // this.receiveNetProxies.push(new TestRecvCProxy());
                        // //2. 初始化 proxy
                        //
                        // //初始化 controller
                        // this.facade.registerCommand(Command.IN.AUTO_LOGIN, AutoLoginCommand);
                        // this.facade.registerCommand(Command.IN.LOGIN_GAME_SERVER, LoginCompleteCommand);
                        break;
                    case common.Command.CHANGE_SCENE: //切换场景
                        if (note.body.sceneName == PlayGameModule.NAME) {
                            this.sendNotification(common.Command.OPEN_VIEW, new common.OpenViewNB(MainMediator.NAME));
                        }
                        break;
                    case common.Command.REGISTER_NET: //注册网络模块
                        // for (let i = 0; i < this.receiveNetProxies.length; i++) {
                        //     this.receiveNetProxies[i].registerNet(game.net);
                        // }
                        break;
                }
            }

            public static NAME = "playGame";
        }
    }
    export var staticData:playGame.StaticData = null;
}

//////////view/MainMediator.ts//////////
namespace game {
    export namespace playGame {
        
        export var mainMediator: MainMediator;

        export class MainMediator extends mvc.Mediator {

            constructor() {
                super(MainMediator.NAME, null);
                mainMediator = this;
            }

            private initUI(): void {
                this.viewComponent = new cc.Node();
                this.viewComponent.addComponent(MainComponent).data = data;
            }

            /**
             * 加载资源
             * @param {Function} resolve
             * @returns {Promise<void>}
             */
            protected async asyncLoad(resolve: Function) {
                super.asyncLoad(resolve);
                await lib.Help.sleep(200);
                await Resource.loadResources();
                // Buffer.instance.createBuffer();
                this.initUI();
                this.loadComplete();
            }

            public listNotificationInterests(): string[] {
                return [common.Command.OPEN_VIEW, common.Command.CLOSE_VIEW];
            }

            public async handleNotification(note: mvc.Notification) {
                switch (note.name) {
                    case common.Command.OPEN_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (!this.viewComponent) {
                            await this.load();
                        }
                        if (this.viewComponent) {
                            layer.MainUILayer.show(this.viewComponent);
                            lib.Tween.to(this.viewComponent, 1, {opacity: 255}, {opacity: 0});
                        }
                        break;
                    case common.Command.CLOSE_VIEW:
                        if (note.body.name != MainMediator.NAME) {
                            return;
                        }
                        if (this.viewComponent && this.viewComponent.parent) {
                            // (this.viewComponent.getComponent(ui.PanelFadeComponent)).fadeOutAndDispose();
                            this.viewComponent.destroy();
                            this.viewComponent = null;
                        }
                        break;
                }
            }

            public static NAME = "playGame.MainMediator";
        }
    }
}

//////////view/MainComponent.ts//////////
namespace game {
    export namespace playGame {
        export class MainComponent extends cc.Component {

            private gameMain: GameMain;
            private panel:cc.Node;

            start() {
                // let panel: cc.Node = cc.instantiate(Resource.getResource("ui"));
                // panel.setContentSize(cc.director.getWinSize().width, cc.director.getWinSize().height);

                // game.data.game.levelId = 1;
                // // console.log(game.data.game.player.roleId);

                // let gameMain = this.gameMain = panel.getChildByName("game").addComponent(GameMain);

                // this.node.addChild(panel);

                // new lib.Binding(panel.getChildByName("progress").getComponent(cc.Label),[game.data.game],"string","{~~(progress*100)}%");
            }
        }
    }
}

//////////view/game/GameMain.ts//////////
namespace game {
    export namespace playGame {
        export class GameMain extends ui.DataComponent {

            //
            isTouchStart:boolean;
            isMoving:boolean;
            onLoad() {
                this.init();
            }
            init() {
                this.isTouchStart = false;
                this.isMoving = false;

            }
            initListen(){
                //this.node.on(cc.Node.EventType.TOUCH_START, this.touchStart, this);
                //this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
                //this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd, this);
            }

            gameOver(){
                // if(game.staticData.reviveNum > 0){
                //     game.staticData.initData();
                //     mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("jumpResult"));
                // }else{
                //     mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("playRevive"));
                //     // mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("jumpDie"));
                // }
            }

        }
    }

}

//////////view/game/MapView.ts//////////


//////////view/game/BridgeView.ts//////////


//////////view/game/background/BackGround.ts//////////


//////////view/game/role/Role.ts//////////


//////////view/game/role/RoleAvatar.ts//////////


//////////view/game/utils/Buffer.ts//////////


//////////model/StaticData.ts//////////


//////////model/FootStepData.ts//////////




//////////Module gameset//////////


window.game = game;
